Skip to content

Latest commit

 

History

History
149 lines (110 loc) · 8.45 KB

README.md

File metadata and controls

149 lines (110 loc) · 8.45 KB

Go API client for BloxOne Anycast API

Anycast capability enables HA (High Availability) configuration of BloxOne applications that run on equipment located on customer's premises (on-prem hosts). Anycast supports DNS, as well as DNS-forwarding services.

Anycast-enabled application setups use multiple on-premises installations for one particular application type. Multiple application instances are configured to use the same endpoint address. Anycast capability is collocated with such application instance, monitoring the local application instance and advertising to the upstream router (a customer equipment) a per-instance, local route to the common application endpoint address, as long as the local application instance is available. Depending on the type of the upstream router, the customer may configure local route advertisement via either BGP (Boarder Gateway Protocol) or OSPF (Open Shortest Path First) routing protocols. Both protocols may be enabled as well. Multiple routes to the common application service address provide redundancy without the need to reconfigure application clients.

Should an application instance become unavailable, the local route advertisements stop, resulting in withdrawal of the route (in the upstream router) to the application instance that has gone out of service and ensuring that subsequent application requests thus get routed to the remaining available application instances.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1
  • Package version: 1.0.0
  • Generator version: 7.5.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the package using go get:

go get github.com/infobloxopen/bloxone-go-client/anycast

Import the package into your code:

import "github.com/infobloxopen/bloxone-go-client/anycast"

To use a proxy, set the environment variable HTTP_PROXY:

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

To create a new API client, you can use the NewAPIClient function as shown below

client := anycast.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:

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:

client := anycast.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:

client := anycast.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 Anycast API. You can obtain an API key by following the instructions in the guide for Configuring User API Keys.

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

client := anycast.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:

client := anycast.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 http://csp.infoblox.com/api/anycast/v1

Class Method HTTP request Description
OnPremAnycastManagerAPI CreateAnycastConfig Post /accm/ac_configs Create Anycast Configuration
OnPremAnycastManagerAPI CreateAnycastVersion Post /accm/ac_version/{id} Create Anycast Version
OnPremAnycastManagerAPI DeleteAnycastConfig Delete /accm/ac_configs/{id} Delete Anycast Configuration
OnPremAnycastManagerAPI DeleteAnycastVersion Delete /accm/ac_version/{id} Delete anycast version
OnPremAnycastManagerAPI DeleteOnpremHost Delete /accm/op_hosts/{id} Delete On-Prem Host
OnPremAnycastManagerAPI GetAnycastConfig Get /accm/ac_configs/{id} Retrieve Anycast Configuration
OnPremAnycastManagerAPI GetAnycastConfigList Get /accm/ac_configs Retrieve Multiple Anycast Configurations
OnPremAnycastManagerAPI GetAnycastVersion Get /accm/ac_version/{id} Retrieve Anycast Version
OnPremAnycastManagerAPI GetOnpremConfig Get /accm/oph_configs/{ophid}/{version} Retrieve Generated, Per-Host Anycast Configuration
OnPremAnycastManagerAPI GetOnpremConfig2 Get /onprem_config/{ophid}/{version} Retrieve Generated, Per-Host Anycast Configuration
OnPremAnycastManagerAPI GetOnpremHost Get /accm/op_hosts/{id} Retrieve On-Prem Host
OnPremAnycastManagerAPI GetStatus Get /accm/oph_config_statuses/{ophid}/latest Retrieve Configuration Status
OnPremAnycastManagerAPI GetStatus2 Get /onprem_config_statuses/{ophid}/latest Retrieve Configuration Status
OnPremAnycastManagerAPI ListAnycastConfigsWithRuntimeStatus Get /accm/ac_runtime_statuses Read list of Anycast Configurations
OnPremAnycastManagerAPI ReadAnycastConfigWithRuntimeStatus Get /accm/ac_runtime_statuses/{id} Read Anycast Configuration
OnPremAnycastManagerAPI UpdateAnycastConfig Put /accm/ac_configs/{id} Create or Update Anycast Configuration
OnPremAnycastManagerAPI UpdateOnpremHost Put /accm/op_hosts/{id} Create or Update On-Prem Host

Documentation For Models

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