# README
Go API client for v1
REST API for the Schema Registry
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: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://confluent.slack.com/app_redirect?channel=data-governance-eng
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://psrc-00000.region.provider.confluent.cloud
Class | Method | HTTP request | Description |
---|---|---|---|
CompatibilityV1Api | TestCompatibilityBySubjectName | Post /compatibility/subjects/{subject}/versions/{version} | Test schema compatibility against a particular schema subject-version |
CompatibilityV1Api | TestCompatibilityForSubject | Post /compatibility/subjects/{subject}/versions | Test schema compatibility against all schemas under a subject |
ConfigV1Api | DeleteSubjectConfig | Delete /config/{subject} | Delete subject compatibility level |
ConfigV1Api | DeleteTopLevelConfig | Delete /config | Delete global compatibility level |
ConfigV1Api | GetClusterConfig | Get /clusterconfig | Get cluster config |
ConfigV1Api | GetSubjectLevelConfig | Get /config/{subject} | Get subject compatibility level |
ConfigV1Api | GetTopLevelConfig | Get /config | Get global compatibility level |
ConfigV1Api | UpdateSubjectLevelConfig | Put /config/{subject} | Update subject compatibility level |
ConfigV1Api | UpdateTopLevelConfig | Put /config | Update global compatibility level |
ContextsV1Api | ListContexts | Get /contexts | List contexts |
DataEncryptionKeysV1Api | CreateDek | Post /dek-registry/v1/keks/{name}/deks | Create a dek. |
DataEncryptionKeysV1Api | DeleteDekVersion | Delete /dek-registry/v1/keks/{name}/deks/{subject}/versions/{version} | Delete a dek version. |
DataEncryptionKeysV1Api | DeleteDekVersions | Delete /dek-registry/v1/keks/{name}/deks/{subject} | Delete all versions of a dek. |
DataEncryptionKeysV1Api | GetDek | Get /dek-registry/v1/keks/{name}/deks/{subject} | Get a dek by subject. |
DataEncryptionKeysV1Api | GetDekByVersion | Get /dek-registry/v1/keks/{name}/deks/{subject}/versions/{version} | Get a dek by subject and version. |
DataEncryptionKeysV1Api | GetDekSubjects | Get /dek-registry/v1/keks/{name}/deks | Get a list of dek subjects. |
DataEncryptionKeysV1Api | GetDekVersions | Get /dek-registry/v1/keks/{name}/deks/{subject}/versions | List versions of dek. |
DataEncryptionKeysV1Api | UndeleteDekVersion | Post /dek-registry/v1/keks/{name}/deks/{subject}/versions/{version}/undelete | Undelete a dek version. |
DataEncryptionKeysV1Api | UndeleteDekVersions | Post /dek-registry/v1/keks/{name}/deks/{subject}/undelete | Undelete all versions of a dek. |
ExportersV1Api | DeleteExporter | Delete /exporters/{name} | Delete schema exporter by name. |
ExportersV1Api | GetExporterConfigByName | Get /exporters/{name}/config | Gets schema exporter config by name. |
ExportersV1Api | GetExporterInfoByName | Get /exporters/{name} | Gets schema exporter by name. |
ExportersV1Api | GetExporterStatusByName | Get /exporters/{name}/status | Gets schema exporter status by name. |
ExportersV1Api | ListExporters | Get /exporters | Gets all schema exporters. |
ExportersV1Api | PauseExporterByName | Put /exporters/{name}/pause | Pause schema exporter by name. |
ExportersV1Api | RegisterExporter | Post /exporters | Creates a new schema exporter. |
ExportersV1Api | ResetExporterByName | Put /exporters/{name}/reset | Reset schema exporter by name. |
ExportersV1Api | ResumeExporterByName | Put /exporters/{name}/resume | Resume schema exporter by name. |
ExportersV1Api | UpdateExporterConfigByName | Put /exporters/{name}/config | Update schema exporter config by name. |
ExportersV1Api | UpdateExporterInfo | Put /exporters/{name} | Update schema exporter by name. |
KeyEncryptionKeysV1Api | CreateKek | Post /dek-registry/v1/keks | Create a kek. |
KeyEncryptionKeysV1Api | DeleteKek | Delete /dek-registry/v1/keks/{name} | Delete a kek. |
KeyEncryptionKeysV1Api | GetKek | Get /dek-registry/v1/keks/{name} | Get a kek by name. |
KeyEncryptionKeysV1Api | GetKekNames | Get /dek-registry/v1/keks | Get a list of kek names. |
KeyEncryptionKeysV1Api | PutKek | Put /dek-registry/v1/keks/{name} | Alters a kek. |
KeyEncryptionKeysV1Api | UndeleteKek | Post /dek-registry/v1/keks/{name}/undelete | Undelete a kek. |
ModesV1Api | DeleteSubjectMode | Delete /mode/{subject} | Delete subject mode |
ModesV1Api | GetMode | Get /mode/{subject} | Get subject mode |
ModesV1Api | GetTopLevelMode | Get /mode | Get global mode |
ModesV1Api | UpdateMode | Put /mode/{subject} | Update subject mode |
ModesV1Api | UpdateTopLevelMode | Put /mode | Update global mode |
SchemasV1Api | GetSchema | Get /schemas/ids/{id} | Get schema string by ID |
SchemasV1Api | GetSchemaOnly | Get /schemas/ids/{id}/schema | Get schema by ID |
SchemasV1Api | GetSchemaTypes | Get /schemas/types | List supported schema types |
SchemasV1Api | GetSchemas | Get /schemas | List schemas |
SchemasV1Api | GetSubjects | Get /schemas/ids/{id}/subjects | List subjects associated to schema ID |
SchemasV1Api | GetVersions | Get /schemas/ids/{id}/versions | List subject-versions associated to schema ID |
SubjectsV1Api | DeleteSchemaVersion | Delete /subjects/{subject}/versions/{version} | Delete schema version |
SubjectsV1Api | DeleteSubject | Delete /subjects/{subject} | Delete subject |
SubjectsV1Api | GetReferencedBy | Get /subjects/{subject}/versions/{version}/referencedby | List schemas referencing a schema |
SubjectsV1Api | GetSchemaByVersion | Get /subjects/{subject}/versions/{version} | Get schema by version |
SubjectsV1Api | GetSchemaOnly1 | Get /subjects/{subject}/versions/{version}/schema | Get schema string by version |
SubjectsV1Api | List | Get /subjects | List subjects |
SubjectsV1Api | ListVersions | Get /subjects/{subject}/versions | List versions under subject |
SubjectsV1Api | LookUpSchemaUnderSubject | Post /subjects/{subject} | Lookup schema under subject |
SubjectsV1Api | Register | Post /subjects/{subject}/versions | Register schema under a subject |
Documentation For Models
- ClusterConfig
- CompatibilityCheckResponse
- Config
- ConfigDefaultMetadata
- ConfigDefaultRuleSet
- ConfigOverrideMetadata
- ConfigOverrideRuleSet
- ConfigUpdateRequest
- CreateDekRequest
- CreateKekRequest
- Dek
- ErrorMessage
- ExporterConfigResponse
- ExporterReference
- ExporterResponse
- ExporterStatusResponse
- ExporterUpdateRequest
- Kek
- Metadata
- Mode
- ModeUpdateRequest
- RegisterExporterRequest
- RegisterSchemaRequest
- RegisterSchemaResponse
- Rule
- RuleSet
- Schema
- SchemaReference
- SchemaString
- SubjectVersion
- UpdateKekRequest
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