# Packages

No description provided by the author
No description provided by the author

# README

Go API client for v3

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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 "./v3"

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://pkc-00000.region.provider.confluent.cloud

ClassMethodHTTP requestDescription
ACLV3ApiBatchCreateKafkaAclsPost /kafka/v3/clusters/{cluster_id}/acls:batchBatch Create ACLs
ACLV3ApiCreateKafkaAclsPost /kafka/v3/clusters/{cluster_id}/aclsCreate an ACL
ACLV3ApiDeleteKafkaAclsDelete /kafka/v3/clusters/{cluster_id}/aclsDelete ACLs
ACLV3ApiGetKafkaAclsGet /kafka/v3/clusters/{cluster_id}/aclsList ACLs
ClusterLinkingV3ApiCreateKafkaLinkPost /kafka/v3/clusters/{cluster_id}/linksCreate a cluster link
ClusterLinkingV3ApiCreateKafkaMirrorTopicPost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrorsCreate a mirror topic
ClusterLinkingV3ApiDeleteKafkaLinkDelete /kafka/v3/clusters/{cluster_id}/links/{link_name}Delete the cluster link
ClusterLinkingV3ApiDeleteKafkaLinkConfigDelete /kafka/v3/clusters/{cluster_id}/links/{link_name}/configs/{config_name}Reset the given config to default value
ClusterLinkingV3ApiGetKafkaLinkGet /kafka/v3/clusters/{cluster_id}/links/{link_name}Describe the cluster link
ClusterLinkingV3ApiGetKafkaLinkConfigsGet /kafka/v3/clusters/{cluster_id}/links/{link_name}/configs/{config_name}Describe the config under the cluster link
ClusterLinkingV3ApiListKafkaLinkConfigsGet /kafka/v3/clusters/{cluster_id}/links/{link_name}/configsList all configs of the cluster link
ClusterLinkingV3ApiListKafkaLinksGet /kafka/v3/clusters/{cluster_id}/linksList all cluster links in the dest cluster
ClusterLinkingV3ApiListKafkaMirrorTopicsGet /kafka/v3/clusters/{cluster_id}/links/-/mirrorsList mirror topics
ClusterLinkingV3ApiListKafkaMirrorTopicsUnderLinkGet /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrorsList mirror topics
ClusterLinkingV3ApiReadKafkaMirrorTopicGet /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors/{mirror_topic_name}Describe the mirror topic
ClusterLinkingV3ApiUpdateKafkaLinkConfigPut /kafka/v3/clusters/{cluster_id}/links/{link_name}/configs/{config_name}Alter the config under the cluster link
ClusterLinkingV3ApiUpdateKafkaLinkConfigBatchPut /kafka/v3/clusters/{cluster_id}/links/{link_name}/configs:alterBatch Alter Cluster Link Configs
ClusterLinkingV3ApiUpdateKafkaMirrorTopicsFailoverPost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors:failoverFailover the mirror topics
ClusterLinkingV3ApiUpdateKafkaMirrorTopicsPausePost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors:pausePause the mirror topics
ClusterLinkingV3ApiUpdateKafkaMirrorTopicsPromotePost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors:promotePromote the mirror topics
ClusterLinkingV3ApiUpdateKafkaMirrorTopicsResumePost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors:resumeResume the mirror topics
ClusterLinkingV3ApiUpdateKafkaMirrorTopicsReverseAndPauseMirrorPost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors:reverse-and-pause-mirrorReverse the local mirror topic and Pause the remote mirror topic
ClusterLinkingV3ApiUpdateKafkaMirrorTopicsReverseAndStartMirrorPost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors:reverse-and-start-mirrorReverse the local mirror topic and start the remote mirror topic
ClusterLinkingV3ApiUpdateKafkaMirrorTopicsTruncateAndRestoreMirrorPost /kafka/v3/clusters/{cluster_id}/links/{link_name}/mirrors:truncate-and-restoreTruncates the local topic to the remote stopped mirror log end offsets and restores mirroring to the local topic to mirror from the remote topic
ClusterV3ApiGetKafkaClusterGet /kafka/v3/clusters/{cluster_id}Get Cluster
ConfigsV3ApiDeleteKafkaClusterConfigDelete /kafka/v3/clusters/{cluster_id}/broker-configs/{name}Reset Dynamic Broker Config
ConfigsV3ApiDeleteKafkaTopicConfigDelete /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/configs/{name}Reset Topic Config
ConfigsV3ApiGetKafkaClusterConfigGet /kafka/v3/clusters/{cluster_id}/broker-configs/{name}Get Dynamic Broker Config
ConfigsV3ApiGetKafkaTopicConfigGet /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/configs/{name}Get Topic Config
ConfigsV3ApiListKafkaAllTopicConfigsGet /kafka/v3/clusters/{cluster_id}/topics/-/configsList All Topic Configs
ConfigsV3ApiListKafkaClusterConfigsGet /kafka/v3/clusters/{cluster_id}/broker-configsList Dynamic Broker Configs
ConfigsV3ApiListKafkaDefaultTopicConfigsGet /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/default-configsList New Topic Default Configs
ConfigsV3ApiListKafkaTopicConfigsGet /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/configsList Topic Configs
ConfigsV3ApiUpdateKafkaClusterConfigPut /kafka/v3/clusters/{cluster_id}/broker-configs/{name}Update Dynamic Broker Config
ConfigsV3ApiUpdateKafkaClusterConfigsPost /kafka/v3/clusters/{cluster_id}/broker-configs:alterBatch Alter Dynamic Broker Configs
ConfigsV3ApiUpdateKafkaTopicConfigPut /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/configs/{name}Update Topic Config
ConfigsV3ApiUpdateKafkaTopicConfigBatchPost /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/configs:alterBatch Alter Topic Configs
ConsumerGroupV3ApiGetKafkaConsumerGet /kafka/v3/clusters/{cluster_id}/consumer-groups/{consumer_group_id}/consumers/{consumer_id}Get Consumer
ConsumerGroupV3ApiGetKafkaConsumerGroupGet /kafka/v3/clusters/{cluster_id}/consumer-groups/{consumer_group_id}Get Consumer Group
ConsumerGroupV3ApiGetKafkaConsumerGroupLagSummaryGet /kafka/v3/clusters/{cluster_id}/consumer-groups/{consumer_group_id}/lag-summaryGet Consumer Group Lag Summary
ConsumerGroupV3ApiGetKafkaConsumerLagGet /kafka/v3/clusters/{cluster_id}/consumer-groups/{consumer_group_id}/lags/{topic_name}/partitions/{partition_id}Get Consumer Lag
ConsumerGroupV3ApiListKafkaConsumerGroupsGet /kafka/v3/clusters/{cluster_id}/consumer-groupsList Consumer Groups
ConsumerGroupV3ApiListKafkaConsumerLagsGet /kafka/v3/clusters/{cluster_id}/consumer-groups/{consumer_group_id}/lagsList Consumer Lags
ConsumerGroupV3ApiListKafkaConsumersGet /kafka/v3/clusters/{cluster_id}/consumer-groups/{consumer_group_id}/consumersList Consumers
PartitionV3ApiGetKafkaPartitionGet /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/partitions/{partition_id}Get Partition
PartitionV3ApiListKafkaPartitionsGet /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/partitionsList Partitions
RecordsV3ApiProduceRecordPost /kafka/v3/clusters/{cluster_id}/topics/{topic_name}/recordsProduce Records
TopicV3ApiCreateKafkaTopicPost /kafka/v3/clusters/{cluster_id}/topicsCreate Topic
TopicV3ApiDeleteKafkaTopicDelete /kafka/v3/clusters/{cluster_id}/topics/{topic_name}Delete Topic
TopicV3ApiGetKafkaTopicGet /kafka/v3/clusters/{cluster_id}/topics/{topic_name}Get Topic
TopicV3ApiListKafkaTopicsGet /kafka/v3/clusters/{cluster_id}/topicsList Topics
TopicV3ApiUpdatePartitionCountKafkaTopicPatch /kafka/v3/clusters/{cluster_id}/topics/{topic_name}Update Partition Count

Documentation For Models

Documentation For Authorization

external-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)

resource-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)

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]