generated

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

README

Go API client for generated

The administration REST API for IBM Event Streams on Cloud.

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.1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

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
go get github.com/antihax/optional

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

import "./generated"

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
DefaultApi CreateTopic Post /admin/topics Create a new topic.
DefaultApi DeleteTopic Delete /admin/topics/{topic_name} Delete a topic.
DefaultApi GetTopic Get /admin/topics/{topic_name} Get detailed information on a topic.
DefaultApi ListTopics Get /admin/topics Get a list of topics.
DefaultApi UpdateTopic Patch /admin/topics/{topic_name} Increase the number of partitions and/or update one or more topic configuration parameters.

Documentation For Models

Documentation For Authorization

APIKeyAuth

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
    Key: "APIKEY",
    Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

BasicAuth

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

TokenAuth

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
    Key: "APIKEY",
    Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	DefaultApi *DefaultApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the IBM Event Streams Administration REST API API v1.1.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type ConfigCreate

type ConfigCreate struct {
	// The name of the config property.
	Name string `json:"name,omitempty"`
	// The value for a config property.
	Value string `json:"value,omitempty"`
}

ConfigCreate struct for ConfigCreate

type ConfigUpdate

type ConfigUpdate struct {
	// The name of the config property.
	Name string `json:"name,omitempty"`
	// The value for a config property.
	Value string `json:"value,omitempty"`
	// When true, the value of the config property is reset to its default value.
	ResetToDefault bool `json:"reset_to_default,omitempty"`
}

ConfigUpdate struct for ConfigUpdate

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerUrl

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type DefaultApiService

type DefaultApiService service

DefaultApiService DefaultApi service

func (*DefaultApiService) CreateTopic

func (a *DefaultApiService) CreateTopic(ctx _context.Context, topicCreate TopicCreateRequest) (map[string]interface{}, *_nethttp.Response, error)

CreateTopic Create a new topic. Create a new topic.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param topicCreate The new topic to be created.

@return map[string]interface{}

func (*DefaultApiService) DeleteTopic

func (a *DefaultApiService) DeleteTopic(ctx _context.Context, topicName string) (map[string]interface{}, *_nethttp.Response, error)

DeleteTopic Delete a topic. Delete a topic.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param topicName The topic name for the topic to be listed.

@return map[string]interface{}

func (*DefaultApiService) GetTopic

func (a *DefaultApiService) GetTopic(ctx _context.Context, topicName string) (TopicDetail, *_nethttp.Response, error)

GetTopic Get detailed information on a topic. Get detailed information on a topic.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param topicName The topic name for the topic to be listed.

@return TopicDetail

func (*DefaultApiService) ListTopics

func (a *DefaultApiService) ListTopics(ctx _context.Context, localVarOptionals *ListTopicsOpts) ([]TopicDetail, *_nethttp.Response, error)

ListTopics Get a list of topics. Returns a list containing information about all of the Kafka topics that are defined for an instance of the Event Streams service. If there are currently no topics defined then an empty list is returned.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ListTopicsOpts - Optional Parameters:
  • @param "TopicFilter" (optional.String) - A filter to be applied to the topic names. A simple filter can be specified as a string with asterisk (`*`) wildcards representing 0 or more characters, e.g. `topic-name*` will filter all topic names that begin with the string `topic-name` followed by any character sequence. A more complex filter pattern can be used by surrounding a regular expression in forward slash (`/`) delimiters, e.g. `/topic-name.* /`.
  • @param "PerPage" (optional.Int32) - The number of topic names to be returns.
  • @param "Page" (optional.Int32) - The page number to be returned. The number 1 represents the first page. The default value is 1.

@return []TopicDetail

func (*DefaultApiService) UpdateTopic

func (a *DefaultApiService) UpdateTopic(ctx _context.Context, topicName string, topicUpdate TopicUpdateRequest) (map[string]interface{}, *_nethttp.Response, error)

UpdateTopic Increase the number of partitions and/or update one or more topic configuration parameters. Increase the number of partitions and/or update one or more topic configuration parameters.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param topicName The topic name for the topic to be listed.
  • @param topicUpdate The new partition number or the configurations to be updated for the topic.

@return map[string]interface{}

type GenericOpenAPIError

type GenericOpenAPIError struct {
	// contains filtered or unexported fields
}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type ListTopicsOpts

type ListTopicsOpts struct {
	TopicFilter optional.String
	PerPage     optional.Int32
	Page        optional.Int32
}

ListTopicsOpts Optional parameters for the method 'ListTopics'

type ModelError

type ModelError struct {
	// The 3-digits http status code plus 2-digits kafka error code.
	ErrorCode int32 `json:"error_code,omitempty"`
	// The error message.
	Message string `json:"message,omitempty"`
	// The incident ID of the error.
	IncidentId string `json:"incident_id,omitempty"`
}

ModelError struct for ModelError

type ReplicaAssignment

type ReplicaAssignment struct {
	// The ID of the partition.
	Id      int32                    `json:"id,omitempty"`
	Brokers ReplicaAssignmentBrokers `json:"brokers,omitempty"`
}

ReplicaAssignment struct for ReplicaAssignment

type ReplicaAssignmentBrokers

type ReplicaAssignmentBrokers struct {
	Replicas []int32 `json:"replicas,omitempty"`
}

ReplicaAssignmentBrokers struct for ReplicaAssignmentBrokers

type ServerConfiguration

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

type TopicConfigs

type TopicConfigs struct {
	// The value of config property 'cleanup.policy'.
	CleanupPolicy string `json:"cleanup.policy,omitempty"`
	// The value of config property 'min.insync.replicas'
	MinInsyncReplicas string `json:"min.insync.replicas,omitempty"`
	// The value of config property 'retention.bytes'.
	RetentionBytes string `json:"retention.bytes,omitempty"`
	// The value of config property 'retention.ms'
	RetentionMs string `json:"retention.ms,omitempty"`
	// The value of config property 'segment.bytes'.
	SegmentBytes string `json:"segment.bytes,omitempty"`
	// The value of config property 'segment.index.bytes'.
	SegmentIndexBytes string `json:"segment.index.bytes,omitempty"`
	// The value of config property 'segment.ms'.
	SegmentMs string `json:"segment.ms,omitempty"`
}

TopicConfigs struct for TopicConfigs

type TopicCreateRequest

type TopicCreateRequest struct {
	// The name of topic to be created.
	Name string `json:"name,omitempty"`
	// The number of partitions.
	Partitions int64 `json:"partitions,omitempty"`
	// The number of partitions, this field takes precedence over 'partitions'. Default value is 1 if not specified.
	PartitionCount int64 `json:"partition_count,omitempty"`
	// The config properties to be set for the new topic.
	Configs []ConfigCreate `json:"configs,omitempty"`
}

TopicCreateRequest struct for TopicCreateRequest

type TopicDetail

type TopicDetail struct {
	// The name of the topic.
	Name string `json:"name,omitempty"`
	// The number of partitions.
	Partitions int32 `json:"partitions,omitempty"`
	// The number of replication factor.
	ReplicationFactor int32 `json:"replicationFactor,omitempty"`
	// The value of config property 'retention.ms'.
	RetentionMs int32 `json:"retentionMs,omitempty"`
	// The value of config property 'cleanup.policy'.
	CleanupPolicy string       `json:"cleanupPolicy,omitempty"`
	Configs       TopicConfigs `json:"configs,omitempty"`
	// The replia assignment of the topic.
	ReplicaAssignments []ReplicaAssignment `json:"replicaAssignments,omitempty"`
}

TopicDetail struct for TopicDetail

type TopicUpdateRequest

type TopicUpdateRequest struct {
	// The new partition number to be increased.
	NewTotalPartitionCount int32 `json:"new_total_partition_count,omitempty"`
	// The config properties to be updated for the topic. Valid config keys are 'cleanup.policy', 'retention.ms', 'retention.bytes', 'segment.bytes', 'segment.ms', 'segment.index.bytes'.
	Configs []ConfigUpdate `json:"configs,omitempty"`
}

TopicUpdateRequest struct for TopicUpdateRequest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL