# Packages

No description provided by the author

# README

Go API client for v1

Network API

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.

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sw "./v1"

To use a proxy, set the environment variable HTTP_PROXY:

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

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.confluent.cloud

ClassMethodHTTP requestDescription
GatewaysNetworkingV1ApiGetNetworkingV1GatewayGet /networking/v1/gateways/{id}Read a Gateway
GatewaysNetworkingV1ApiListNetworkingV1GatewaysGet /networking/v1/gatewaysList of Gateways
NetworkLinkEndpointsNetworkingV1ApiCreateNetworkingV1NetworkLinkEndpointPost /networking/v1/network-link-endpointsCreate a Network Link Endpoint
NetworkLinkEndpointsNetworkingV1ApiDeleteNetworkingV1NetworkLinkEndpointDelete /networking/v1/network-link-endpoints/{id}Delete a Network Link Endpoint
NetworkLinkEndpointsNetworkingV1ApiGetNetworkingV1NetworkLinkEndpointGet /networking/v1/network-link-endpoints/{id}Read a Network Link Endpoint
NetworkLinkEndpointsNetworkingV1ApiListNetworkingV1NetworkLinkEndpointsGet /networking/v1/network-link-endpointsList of Network Link Endpoints
NetworkLinkEndpointsNetworkingV1ApiUpdateNetworkingV1NetworkLinkEndpointPatch /networking/v1/network-link-endpoints/{id}Update a Network Link Endpoint
NetworkLinkServiceAssociationsNetworkingV1ApiGetNetworkingV1NetworkLinkServiceAssociationGet /networking/v1/network-link-service-associations/{id}Read a Network Link Service Association
NetworkLinkServiceAssociationsNetworkingV1ApiListNetworkingV1NetworkLinkServiceAssociationsGet /networking/v1/network-link-service-associationsList of Network Link Service Associations
NetworkLinkServicesNetworkingV1ApiCreateNetworkingV1NetworkLinkServicePost /networking/v1/network-link-servicesCreate a Network Link Service
NetworkLinkServicesNetworkingV1ApiDeleteNetworkingV1NetworkLinkServiceDelete /networking/v1/network-link-services/{id}Delete a Network Link Service
NetworkLinkServicesNetworkingV1ApiGetNetworkingV1NetworkLinkServiceGet /networking/v1/network-link-services/{id}Read a Network Link Service
NetworkLinkServicesNetworkingV1ApiListNetworkingV1NetworkLinkServicesGet /networking/v1/network-link-servicesList of Network Link Services
NetworkLinkServicesNetworkingV1ApiUpdateNetworkingV1NetworkLinkServicePatch /networking/v1/network-link-services/{id}Update a Network Link Service
NetworksNetworkingV1ApiCreateNetworkingV1NetworkPost /networking/v1/networksCreate a Network
NetworksNetworkingV1ApiDeleteNetworkingV1NetworkDelete /networking/v1/networks/{id}Delete a Network
NetworksNetworkingV1ApiGetNetworkingV1NetworkGet /networking/v1/networks/{id}Read a Network
NetworksNetworkingV1ApiListNetworkingV1NetworksGet /networking/v1/networksList of Networks
NetworksNetworkingV1ApiUpdateNetworkingV1NetworkPatch /networking/v1/networks/{id}Update a Network
PeeringsNetworkingV1ApiCreateNetworkingV1PeeringPost /networking/v1/peeringsCreate a Peering
PeeringsNetworkingV1ApiDeleteNetworkingV1PeeringDelete /networking/v1/peerings/{id}Delete a Peering
PeeringsNetworkingV1ApiGetNetworkingV1PeeringGet /networking/v1/peerings/{id}Read a Peering
PeeringsNetworkingV1ApiListNetworkingV1PeeringsGet /networking/v1/peeringsList of Peerings
PeeringsNetworkingV1ApiUpdateNetworkingV1PeeringPatch /networking/v1/peerings/{id}Update a Peering
PrivateLinkAccessesNetworkingV1ApiCreateNetworkingV1PrivateLinkAccessPost /networking/v1/private-link-accessesCreate a Private Link Access
PrivateLinkAccessesNetworkingV1ApiDeleteNetworkingV1PrivateLinkAccessDelete /networking/v1/private-link-accesses/{id}Delete a Private Link Access
PrivateLinkAccessesNetworkingV1ApiGetNetworkingV1PrivateLinkAccessGet /networking/v1/private-link-accesses/{id}Read a Private Link Access
PrivateLinkAccessesNetworkingV1ApiListNetworkingV1PrivateLinkAccessesGet /networking/v1/private-link-accessesList of Private Link Accesses
PrivateLinkAccessesNetworkingV1ApiUpdateNetworkingV1PrivateLinkAccessPatch /networking/v1/private-link-accesses/{id}Update a Private Link Access
TransitGatewayAttachmentsNetworkingV1ApiCreateNetworkingV1TransitGatewayAttachmentPost /networking/v1/transit-gateway-attachmentsCreate a Transit Gateway Attachment
TransitGatewayAttachmentsNetworkingV1ApiDeleteNetworkingV1TransitGatewayAttachmentDelete /networking/v1/transit-gateway-attachments/{id}Delete a Transit Gateway Attachment
TransitGatewayAttachmentsNetworkingV1ApiGetNetworkingV1TransitGatewayAttachmentGet /networking/v1/transit-gateway-attachments/{id}Read a Transit Gateway Attachment
TransitGatewayAttachmentsNetworkingV1ApiListNetworkingV1TransitGatewayAttachmentsGet /networking/v1/transit-gateway-attachmentsList of Transit Gateway Attachments
TransitGatewayAttachmentsNetworkingV1ApiUpdateNetworkingV1TransitGatewayAttachmentPatch /networking/v1/transit-gateway-attachments/{id}Update a Transit Gateway Attachment

Documentation For Models

Documentation For Authorization

cloud-api-key

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

confluent-sts-access-token

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

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

Author

[email protected]