Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go-sdk Changes for Bloxone Redirect #44

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The following Bloxone APIs are supported:
## Bloxone Threat Defense
- [Threat Defense Cloud (FW API)](fw/README.md)
- [DNS Forwarding Proxy (DFP API)](dfp/README.md)
- [Redirect](redirect/README.md)

## Bloxone DDI
- [IP Address Management](ipam/README.md)
Expand Down
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/infobloxopen/bloxone-go-client/ipam"
"github.com/infobloxopen/bloxone-go-client/keys"
"github.com/infobloxopen/bloxone-go-client/option"
"github.com/infobloxopen/bloxone-go-client/redirect"
)

// APIClient is an aggregation of different BloxOne API clients.
Expand All @@ -24,6 +25,7 @@ type APIClient struct {
DNSForwardingProxyAPI *dfp.APIClient
FWAPI *fw.APIClient
AnycastAPI *anycast.APIClient
RedirectAPI *redirect.APIClient
}

// NewAPIClient creates a new BloxOne API Client.
Expand Down Expand Up @@ -57,5 +59,6 @@ func NewAPIClient(options ...option.ClientOption) *APIClient {
DNSForwardingProxyAPI: dfp.NewAPIClient(options...),
FWAPI: fw.NewAPIClient(options...),
AnycastAPI: anycast.NewAPIClient(options...),
RedirectAPI: redirect.NewAPIClient(options...),
}
}
23 changes: 23 additions & 0 deletions redirect/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
68 changes: 68 additions & 0 deletions redirect/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.openapi-generator-ignore
README.md
api/openapi.yaml
api_certificate.go
api_custom_redirects.go
api_redirect_page.go
client.go
docs/CertificateAPI.md
docs/CertificateGetProxyCertificates500Response.md
docs/CertificateGetProxyCertificates500ResponseError.md
docs/CustomRedirect.md
docs/CustomRedirectCreateResponse.md
docs/CustomRedirectDeleteRequest.md
docs/CustomRedirectMultiResponse.md
docs/CustomRedirectReadResponse.md
docs/CustomRedirectUpdateResponse.md
docs/CustomRedirectsAPI.md
docs/CustomRedirectsCreateCustomRedirect400Response.md
docs/CustomRedirectsCreateCustomRedirect400ResponseError.md
docs/CustomRedirectsCreateCustomRedirect409Response.md
docs/CustomRedirectsCreateCustomRedirect409ResponseError.md
docs/CustomRedirectsDeleteCustomRedirect400Response.md
docs/CustomRedirectsDeleteCustomRedirect400ResponseError.md
docs/CustomRedirectsDeleteSingleCustomRedirect400Response.md
docs/CustomRedirectsDeleteSingleCustomRedirect400ResponseError.md
docs/CustomRedirectsReadCustomRedirect404Response.md
docs/CustomRedirectsReadCustomRedirect404ResponseError.md
docs/CustomRedirectsUpdateCustomRedirect409Response.md
docs/CustomRedirectsUpdateCustomRedirect409ResponseError.md
docs/ProxyCertResponse.md
docs/RedirectPage.md
docs/RedirectPageAPI.md
docs/RedirectPageReadResponse.md
docs/RedirectPageUpdateRedirectPage400Response.md
docs/RedirectPageUpdateRedirectPage400ResponseError.md
docs/RedirectPageUpdateResponse.md
docs/UpdateRedirectPagePayload.md
model_certificate_get_proxy_certificates_500_response.go
model_certificate_get_proxy_certificates_500_response_error.go
model_custom_redirect.go
model_custom_redirect_create_response.go
model_custom_redirect_delete_request.go
model_custom_redirect_multi_response.go
model_custom_redirect_read_response.go
model_custom_redirect_update_response.go
model_custom_redirects_create_custom_redirect_400_response.go
model_custom_redirects_create_custom_redirect_400_response_error.go
model_custom_redirects_create_custom_redirect_409_response.go
model_custom_redirects_create_custom_redirect_409_response_error.go
model_custom_redirects_delete_custom_redirect_400_response.go
model_custom_redirects_delete_custom_redirect_400_response_error.go
model_custom_redirects_delete_single_custom_redirect_400_response.go
model_custom_redirects_delete_single_custom_redirect_400_response_error.go
model_custom_redirects_read_custom_redirect_404_response.go
model_custom_redirects_read_custom_redirect_404_response_error.go
model_custom_redirects_update_custom_redirect_409_response.go
model_custom_redirects_update_custom_redirect_409_response_error.go
model_proxy_cert_response.go
model_redirect_page.go
model_redirect_page_read_response.go
model_redirect_page_update_redirect_page_400_response.go
model_redirect_page_update_redirect_page_400_response_error.go
model_redirect_page_update_response.go
model_update_redirect_page_payload.go
test/api_certificate_test.go
test/api_custom_redirects_test.go
test/api_redirect_page_test.go
utils.go
1 change: 1 addition & 0 deletions redirect/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.5.0
145 changes: 145 additions & 0 deletions redirect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Go API client for BloxOne Redirect API

You can configure BloxOne Threat Defense Cloud to redirect traffic to the Infoblox server that displays the default or customized redirect page. You can redirect traffic to a custom destination using custom redirects.


## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: v1
- Generator version: 7.5.0
- Build package: com.infoblox.codegen.BloxoneGoClientCodegen

## Installation

Install the package using `go get`:
```bash
go get github.com/infobloxopen/bloxone-go-client/redirect
```

Import the package into your code:
```go
import "github.com/infobloxopen/bloxone-go-client/redirect"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

To create a new API client, you can use the `NewAPIClient` function as shown below
```go
client := redirect.NewAPIClient()
```

## Configuration

The `NewAPIClient` function accepts a variadic list of `option.ClientOption` functions that can be used to configure the client.
It requires the `option` package to be imported. You can import the package using:
```go
import "github.com/infobloxopen/bloxone-go-client/option"
```

### Client Name
The client name is used to identify the client in the logs. By default, the client name is set to `bloxone-go-client`. You can change this using the `option.WithClientName` option. For example:
```go
client := redirect.NewAPIClient(option.WithClientName("my-client"))
```

### Server URL

The default URL for the Cloud Services Portal is `https://csp.infoblox.com`. If you need to change this, you can use `option.WithCSPUrl` to set the URL. For example:

```go
client := redirect.NewAPIClient(option.WithCSPUrl("https://csp.eu.infoblox.com"))
```

You can also set the URL using the environment variable `BLOXONE_CSP_URL`

### Authorization

An API key is required to access BloxOne Redirect API. You can obtain an API key by following the instructions in the guide for [Configuring User API Keys](https://docs.infoblox.com/space/BloxOneCloud/35430405/Configuring+User+API+Keys).

To use an API key with BloxOne Redirect API, you can use the `option.WithAPIKey` option. For example:

```go
client := redirect.NewAPIClient(option.WithAPIKey("YOUR_API_KEY"))
```

You can also set the API key using the environment variable `BLOXONE_API_KEY`

Note: The API key is a secret and should be handled securely. Hardcoding the API key in your code is not recommended.

### Default Tags

You can set default tags for all API requests using the `option.WithDefaultTags` option. For example:

```go
client := redirect.NewAPIClient(option.WithDefaultTags(map[string]string{"tag1": "value1", "tag2": "value2"}))
```
This will add the tags `tag1=value1` and `tag2=value2` to all API requests that support tags in the request body.

## Documentation for API Endpoints

All URIs are relative to *https://csp.infoblox.com/api/atcfw/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*CertificateAPI* | [**GetProxyCertificates**](docs/CertificateAPI.md#getproxycertificates) | **Get** /cert_download_urls | Get Proxy Certificates
*CustomRedirectsAPI* | [**CreateCustomRedirect**](docs/CustomRedirectsAPI.md#createcustomredirect) | **Post** /custom_redirects | Create Custom Redirect.
*CustomRedirectsAPI* | [**DeleteCustomRedirect**](docs/CustomRedirectsAPI.md#deletecustomredirect) | **Delete** /custom_redirects | Delete Custom Redirect.
*CustomRedirectsAPI* | [**DeleteSingleCustomRedirect**](docs/CustomRedirectsAPI.md#deletesinglecustomredirect) | **Delete** /custom_redirects/{id} | Delete Custom Redirect By Id.
*CustomRedirectsAPI* | [**ListCustomRedirect**](docs/CustomRedirectsAPI.md#listcustomredirect) | **Get** /custom_redirects | List Custom Redirects.
*CustomRedirectsAPI* | [**ReadCustomRedirect**](docs/CustomRedirectsAPI.md#readcustomredirect) | **Get** /custom_redirects/{id} | Read Custom Redirect.
*CustomRedirectsAPI* | [**UpdateCustomRedirect**](docs/CustomRedirectsAPI.md#updatecustomredirect) | **Put** /custom_redirects/{id} | Update Custom Redirect.
*RedirectPageAPI* | [**ReadRedirectPage**](docs/RedirectPageAPI.md#readredirectpage) | **Get** /redirect_page | Read Redirect Page.
*RedirectPageAPI* | [**UpdateRedirectPage**](docs/RedirectPageAPI.md#updateredirectpage) | **Put** /redirect_page | Update Redirect Page.


## Documentation For Models

- [CertificateGetProxyCertificates500Response](docs/CertificateGetProxyCertificates500Response.md)
- [CertificateGetProxyCertificates500ResponseError](docs/CertificateGetProxyCertificates500ResponseError.md)
- [CustomRedirect](docs/CustomRedirect.md)
- [CustomRedirectCreateResponse](docs/CustomRedirectCreateResponse.md)
- [CustomRedirectDeleteRequest](docs/CustomRedirectDeleteRequest.md)
- [CustomRedirectMultiResponse](docs/CustomRedirectMultiResponse.md)
- [CustomRedirectReadResponse](docs/CustomRedirectReadResponse.md)
- [CustomRedirectUpdateResponse](docs/CustomRedirectUpdateResponse.md)
- [CustomRedirectsCreateCustomRedirect400Response](docs/CustomRedirectsCreateCustomRedirect400Response.md)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ...Response models didn't get renamed. Maybe the model name mappings script doesn't account for that. Something to be fixed i guess.

- [CustomRedirectsCreateCustomRedirect400ResponseError](docs/CustomRedirectsCreateCustomRedirect400ResponseError.md)
- [CustomRedirectsCreateCustomRedirect409Response](docs/CustomRedirectsCreateCustomRedirect409Response.md)
- [CustomRedirectsCreateCustomRedirect409ResponseError](docs/CustomRedirectsCreateCustomRedirect409ResponseError.md)
- [CustomRedirectsDeleteCustomRedirect400Response](docs/CustomRedirectsDeleteCustomRedirect400Response.md)
- [CustomRedirectsDeleteCustomRedirect400ResponseError](docs/CustomRedirectsDeleteCustomRedirect400ResponseError.md)
- [CustomRedirectsDeleteSingleCustomRedirect400Response](docs/CustomRedirectsDeleteSingleCustomRedirect400Response.md)
- [CustomRedirectsDeleteSingleCustomRedirect400ResponseError](docs/CustomRedirectsDeleteSingleCustomRedirect400ResponseError.md)
- [CustomRedirectsReadCustomRedirect404Response](docs/CustomRedirectsReadCustomRedirect404Response.md)
- [CustomRedirectsReadCustomRedirect404ResponseError](docs/CustomRedirectsReadCustomRedirect404ResponseError.md)
- [CustomRedirectsUpdateCustomRedirect409Response](docs/CustomRedirectsUpdateCustomRedirect409Response.md)
- [CustomRedirectsUpdateCustomRedirect409ResponseError](docs/CustomRedirectsUpdateCustomRedirect409ResponseError.md)
- [ProxyCertResponse](docs/ProxyCertResponse.md)
- [RedirectPage](docs/RedirectPage.md)
- [RedirectPageReadResponse](docs/RedirectPageReadResponse.md)
- [RedirectPageUpdateRedirectPage400Response](docs/RedirectPageUpdateRedirectPage400Response.md)
- [RedirectPageUpdateRedirectPage400ResponseError](docs/RedirectPageUpdateRedirectPage400ResponseError.md)
- [RedirectPageUpdateResponse](docs/RedirectPageUpdateResponse.md)
- [UpdateRedirectPagePayload](docs/UpdateRedirectPagePayload.md)


## Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains
a number of utility functions to easily obtain pointers to values of basic types.
Each of these functions takes a value of the given basic type and returns a pointer to it:

* `PtrBool`
* `PtrInt`
* `PtrInt32`
* `PtrInt64`
* `PtrFloat`
* `PtrFloat32`
* `PtrFloat64`
* `PtrString`
* `PtrTime`
Loading
Loading