diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..926b9e0 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,13 @@ +[bumpversion] +current_version = 0.0.1 +commit = True +message = Update version {current_version} -> {new_version} [skip ci] + +[bumpversion:file:common/version.go] +search = const Version = "{current_version}" +replace = const Version = "{new_version}" + +[bumpversion:file:README.md] +search = {current_version} +replace = {new_version} + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7d2b3cf --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.enc binary diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..354f642 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,30 @@ +--- +name: Bug report +about: Create a bug report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +List the steps that can be used to demonstrate the bug. Include the name of the service and operation that you're trying to invoke, if applicable. Be sure to describe any relevant info regarding parameter values used with your API invocation. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Must gather (please complete the following information):** + - SDK Version [e.g. 1.2.1] + - Go Version [e.g. 1.12.15] + - Name of service that you're trying to use (if applicable) + - Name of operation that you're trying to invoke (if applicable) + +**Additional context** +Add any other context about the problem here. +Were you able to avoid the problem by changing your application code slightly? diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..d686356 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,36 @@ +## PR summary + + +**Fixes:** + +## PR Checklist +Please make sure that your PR fulfills the following requirements: +- [ ] The commit message follows the [Angular Commit Message Guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). +- [ ] Tests for the changes have been added (for bug fixes / features) +- [ ] Docs have been added / updated (for bug fixes / features) + +## PR Type + +- [ ] Bugfix +- [ ] Feature +- [ ] Code style update (formatting, local variables) +- [ ] Refactoring (no functional changes, no api changes) +- [ ] New tests +- [ ] Build/CI related changes +- [ ] Documentation content changes +- [ ] Other (please describe) + +## What is the current behavior? + + +## What is the new behavior? + + +## Does this PR introduce a breaking change? +- [ ] Yes +- [ ] No + + + +## Other information + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3c820a --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store +.env + +# ignore vendor/ +vendor/ + +# SDK generator +.openapi-generator-ignore +.openapi-generator/VERSION +/.project + +# credentials files +*.env + +# IDE files +*.idea +.vscode/ +*.log + +# coverage +coverage.txt + +# example binary +example diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..0ac09f4 --- /dev/null +++ b/.releaserc @@ -0,0 +1,22 @@ +{ + "debug": true, + "branches": [ "main" ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/exec", + { + "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" + } + ], + [ + "@semantic-release/git", + { + "message": "chore(release): ${nextRelease.version} release notes [skip ci]\n\n${nextRelease.notes}" + } + ], + "@semantic-release/github" + ] +} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e8bdada --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ + language: go + +dist: xenial + +go: "1.14.x" + +notifications: + email: true + +env: + global: + - GO111MODULE=on + +before_install: + - sudo apt-get update + - sudo apt-get install python + - nvm install 12 + - npm install -g npm@6.x + +install: + - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.21.0 + - curl -s https://codecov.io/bash > $HOME/codecov-bash.sh && chmod +x $HOME/codecov-bash.sh + +script: + - make travis-ci + diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..7303c87 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at phil_adams@us.ibm.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ef6277b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Questions +If you are having problems using the APIs or have a question about IBM Cloud services, +please ask a question at +[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). + +# Issues +If you encounter an issue with the project, you are welcome to submit a +[bug report](https://github.com/IBM/eventstreams-go-sdk/issues). +Before that, please search for similar issues. It's possible that someone has already reported the problem. + +# General Information +For general guidance on contributing to this project, please see +[this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/main/CONTRIBUTING_go.md) + diff --git a/LICENSE b/LICENSE index 261eeb9..a430bbe 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright [year] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1ab15d8 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +# Makefile to build the project + +COVERAGE = -coverprofile=coverage.txt -covermode=atomic + +all: test lint tidy build + +travis-ci: test-cov lint tidy + +test: + go test -v -coverpkg=./... -covermode=atomic -coverprofile=cover.out -timeout 2m ./... 2>&1 | tee testoutput.log; go tool cover -func=cover.out + +test-cov: + go test `go list ./...` ${COVERAGE} + +test-int: + go test `go list ./...` -tags=integration + +test-int-cov: + go test `go list ./...` -tags=integration ${COVERAGE} + +lint: + golangci-lint run + +tidy: + go mod tidy + +clean: + rm -f example + +build: example.go + go build example.go \ No newline at end of file diff --git a/README.md b/README.md index f9ef0e0..26ba918 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,748 @@ -# eventstreams-go-sdk -Event Streams SDK allows you to integrate your application with Event Streams RESTful APIs. +[![Build Status](https://travis-ci.com/IBM/eventstreams-go-sdk.svg?&branch=main)](https://travis-ci.com/IBM/eventstreams-go-sdk) +[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) +# IBM Cloud Eventstreams Go SDK Version 1.1.0 -Coming soon! +## Introduction + +IBM Event Streams for IBM Cloud™ is a high-throughput message bus built with Apache Kafka. +It is optimized for event ingestion into IBM Cloud and event stream distribution between your services and applications. + +Event Streams provides a REST API to help connect your existing systems to your Event Streams Kafka cluster. +Using the API, you can integrate Event Streams with any system that supports RESTful APIs. + +Documentation [IBM Cloud Eventstreams Service APIs](https://cloud.ibm.com/apidocs/event-streams). + +This is the Eventstreams Software Development Kit for `Go` +It includes a library of functions used to access a Eventstreams cluster. + +## Table of Contents + + + + +- [Overview](#overview) +- [Prerequisites](#prerequisites) +- [Installation](#installation) + + [`go get` command](#go-get-command) + + [Go modules](#go-modules) + + [`dep` dependency manager](#dep-dependency-manager) +- [Using the SDK](#using-the-sdk) +- [REST API documentation](#event-streams-administration-rest-api) +- [Questions](#questions) +- [Issues](#issues) +- [Open source @ IBM](#open-source--ibm) +- [Contributing](#contributing) +- [License](#license) + + + +## Overview + +The IBM Cloud Eventstreams Go SDK allows developers to programmatically interact with the following IBM Cloud services: + +Service Name | Package name +--- | --- +[Admin Rest](https://cloud.ibm.com/apidocs/event-streams) | AdminRest + +## Prerequisites + +* An [IBM Cloud](https://cloud.ibm.com/registration) account. +* The [IBM Cloud CLI.](https://cloud.ibm.com/docs/cli?topic=cli-getting-started) +* An IAM API key to allow the SDK to access your account. Create one [here](https://cloud.ibm.com/iam/apikeys). +* A IBM Cloud Eventstreams Instance Create one [here](https://cloud.ibm.com/registration?target=/catalog/services/event-streams) +* Go version 1.14 or above. + +## Installation +The current version of this SDK: 1.1.0 + +There are a few different ways to download and install the Eventstreams Go SDK project for use by your +Go application: + +#### `go get` command +Use this command to download and install the SDK to allow your Go application to +use it: + +``` +go get -u github.ibm.com/IBM/eventstreams-go-sdk +``` + +#### Go modules +If your application is using Go modules, you can add a suitable import to your +Go application, like this: + +```go +import ( + "github.ibm.com/IBM/eventstreams-go-sdk/pkg/adminrestv1" +) +``` + +then run `go mod tidy` to download and install the new dependency and update your Go application's +`go.mod` file. + +#### `dep` dependency manager +If your application is using the `dep` dependency management tool, you can add a dependency +to your `Gopkg.toml` file. Here is an example: + +``` +[[constraint]] + name = "github.ibm.com/IBM/eventstreams-go-sdk" + version = "1.1.0" + +``` + +then run `dep ensure`. + +## Using the SDK +For general SDK usage information, please see [this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/main/README.md) + +## Questions + +If you are having difficulties using this SDK or have a question about the IBM Cloud services, +please ask a question at +[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). + +## Issues +If you encounter an issue with the project, you are welcome to submit a +[bug report](https://github.com/IBM/eventstreams-go-sdk/issues). +Before that, please search for similar issues. It's possible that someone has already reported the problem. + +## Open source @ IBM +Find more open source projects on the [IBM Github Page](http://ibm.github.io/) + +## Contributing +See [CONTRIBUTING](CONTRIBUTING.md). + +## License + +This SDK project is released under the Apache 2.0 license. +The license's full text can be found in [LICENSE](LICENSE). + +# Event Streams Administration REST API + +This REST API allows users of the +[IBM Event Streams service](https://cloud.ibm.com/docs/services/EventStreams/index.html) +to administer +[Kafka topics](#using-the-rest-api-to-administer-kafka-topics) +associated with an instance of the service. You can use this API to perform the following +operations: + - [Create a Kafka topic](#creating-a-kafka-topic) + - [List Kafka topics](#listing-kafka-topics) + - [Get a Kafka topic](#getting-a-kafka-topic) + - [Delete a Kafka topic](#deleting-a-kafka-topic) + - [Update a Kafka topic configuration](#updating-kafka-topics-configuration) + - [List which topics are mirrored](#list-current-mirroring-topic-selection) + - [Replace selection of topics which are mirrored](#replace-selection-of-topics-which-are-mirrored) + - [List active mirroring topics](#list-active-mirroring-topics) + +The Admin REST API is also [documented using swagger](./admin-rest-api.yaml). + +## Access control +--- + +All requests support below authorization methods: + * Basic authorization with user and password. ( + For both standard, enterprise and lite plans, user is 'token', password is the API key from `ibmcloud resource service-keys` for the service instance.) + * Bearer authorization with bearer token. (This token can be either API key or JWT token obtained from IAM upon login to IBM Cloud. Use `ibmcloud iam oauth-tokens` to retrieve the token after `ibmcloud login`) + * `X-Auth-Token` header to be set to the API key. This header is deprecated. + +## Administration API endpoint +--- +Administration API endpoint is the `kafka_admin_url` property in the service key for the service instance. This command can be used to retrieve this property. +```bash +$ibmcloud resource service-key "${service_instance_key_name}" --output json > jq -r '.[]|.credentials.kafka_admin_url' +``` + +## Environment Setup +In the examples you must set and export environment variables as follows: +- Either the `API_KEY` or `BEARER_TOKEN` to use for authentication. +- `KAFKA_ADMIN_URL` to point to your Eventstreams admin endpoint. + +In addition, the `Content-type` header has to be set to `application/json`. + +Common HTTP status codes: +- 200: Request succeeded. +- 202: Request was accepted. +- 400: Invalid request JSON. +- 401: The authentication header is not set or provided information is not valid. +- 403: Not authorized to perform the operation. Usually it means the API key used is missing a certain role. More details on what role can perform what operation refers to this [document](https://cloud.ibm.com/docs/services/EventStreams?topic=eventstreams-security). +- 404: Unable to find the topic with topic name given by user. +- 422: Semantically invalid request. +- 503: An error occurred handling the request. + +Error responses carry a JSON body like the following: +```json +{"error_code":50301,"message":"Unknown Kafka Error", "incident_id": "17afe715-0ff5-4c49-9acc-a4204244a331"} +``` +Error codes are of the format `HHHKK` where `HHH` is the HTTP Status Code and `KK` is the Kafka protocol error. + +For E2E debugging purposes, the transaction ID of every request is returned in the HTTP header `X-Global-Transaction-Id`. +If the header is set on the request, it will be honored. If not, it will be generated. +In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as `incident_id`. + + +## Using the REST API to administer Kafka topics +--- + +To run the example :- + +Compile the code. +```sh +go build -o example +``` +Or simply +```sh +make build +``` + +Set the required environment variables +```sh +# Set your API KEY (or a bearer token could be used by setting the BEARER_TOKEN environment variable instead, but not both) +export API_KEY="abc123456789" + +# Set the Admin Endpoint to point to your cluster. +export KAFKA_ADMIN_URL="https://xyzclustername.svc01.region.eventstreams.test.cloud.ibm.com" + +``` + +Run the example +```sh +./example +``` + +## REST API +--- +The following sections explain how the REST API works with examples. + +### Code Setup + +```golang +// Code Setup +import ( + "fmt" + "net/http" + "os" + + "github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1" + "github.com/IBM/go-sdk-core/v4/core" +) + +// End Code Setup +``` + +### Authentication +--- +Use one of the following methods to authenticate: + +- To authenticate using Basic Auth: + Place these values into the Authorization header of the HTTP request in the form Basic + where is the username and password joined by a single colon `:` base64 encoded. + For example: + ```sh + echo -n "token:" | base64 + ``` + +- To authenticate using a bearer token: + To obtain your token using the IBM Cloud CLI, first log in to IBM Cloud, then run the following command: + ``` + ibmcloud iam oauth-tokens + ``` + Place this token in the Authorization header of the HTTP request in the form Bearer. Both API key or JWT tokens are supported. + +- To authenticate directly using the api_key: + Place the key directly as the value of the X-Auth-Token HTTP header. + +#### Example + +Here's an example of how to create the authenticator using either an API key or a BEARER_TOKEN + +```golang + // Create Authenticator + var authenticator core.Authenticator + + if apiKey != "" { + var err error + // Create an Basic IAM authenticator. + authenticator, err = core.NewBasicAuthenticator("token", apiKey) + if err != nil { + fmt.Printf("failed to create new basic authenticator: %s\n", err.Error()) + os.Exit(1) + } + } else { + var err error + // Create an IAM Bearer Token authenticator. + authenticator, err = core.NewBearerTokenAuthenticator(bearerToken) + if err != nil { + fmt.Printf("failed to create new bearer token authenticator: %s\n", err.Error()) + os.Exit(1) + } + } + // End Authenticator +``` + +### Creating a client for the Admin REST API. +--- +Create a new service object. + +```golang + // Create Service + serviceAPI, serviceErr := adminrestv1.NewAdminrestV1(&adminrestv1.AdminrestV1Options{ + URL: URL, + Authenticator: authenticator, + }) + // End Create Service +``` + +### Creating a Kafka topic +--- +To create a Kafka topic the admin REST SDK issues a POST request to the /admin/topics path. +The body of the request contains a JSON document, for example: +```json +{ + "name": "topicname", + "partitions": 1, + "configs": { + "retentionMs": 86400000, + "cleanupPolicy": "delete" + } +} +``` + +The only required field is name. The partitions fields defaults to 1 if not set. + +Expected HTTP status codes: + +- 202: Topic creation request was accepted. +- 400: Invalid request JSON. +- 403: Not authorized to create topic. +- 422: Semantically invalid request. + +If the request to create a Kafka topic succeeds then HTTP status code 202 (Accepted) is returned. If the operation fails then a HTTP status code of 422 (Un-processable Entity) is returned, and a JSON object containing additional information about the failure is returned as the body of the response. + + + + +#### Example + +```golang +func createTopic(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the createTopicOptionsModel. + createTopicOptionsModel := new(adminrestv1.CreateTopicOptions) + createTopicOptionsModel.Name = core.StringPtr("test-topic") + createTopicOptionsModel.PartitionCount = core.Int64Ptr(int64(1)) + + // Create the Topic. + response, operationErr := serviceAPI.CreateTopic(createTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Creating Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Creating Topic: status %d\n", response.StatusCode) + } + + fmt.Printf("\tname: %s created\n", *createTopicOptionsModel.Name) + + return nil +} +``` + + +### Deleting a Kafka topic +--- +To delete a Kafka topic, the admin REST SDK issues a DELETE request to the `/admin/topics/TOPICNAME` +path (where `TOPICNAME` is the name of the Kafka topic that you want to delete). + +Expected return codes: +- 202: Topic deletion request was accepted. +- 403: Not authorized to delete topic. +- 404: Topic does not exist. +- 422: Semantically invalid request. + +A 202 (Accepted) status code is returned if the REST API accepts the delete +request or status code 422 (Un-processable Entity) if the delete request is +rejected. If a delete request is rejected then the body of the HTTP response +will contain a JSON object which provides additional information about why +the request was rejected. + +Kafka deletes topics asynchronously. Deleted topics may still appear in the +response to a [list topics request](#listing-kafka-topics) for a short period +of time after the completion of a REST request to delete the topic. + +#### Example + +```golang +func deleteTopic(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the DeleteTopicOptions model + deleteTopicOptionsModel := new(adminrestv1.DeleteTopicOptions) + deleteTopicOptionsModel.TopicName = core.StringPtr("test-topic") + + // Delete Topic + response, operationErr := serviceAPI.DeleteTopic(deleteTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Deleting Topic: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Deleting Topic: status %d\n", response.StatusCode) + } + + fmt.Printf("\tname: %s deleted\n", *deleteTopicOptionsModel.TopicName) + return nil +} +``` + +### Listing Kafka topics +--- +You can list all of your Kafka topics by issuing a GET request to the +`/admin/topics` path. + +Expected status codes: +- 200: the topic list is returned as JSON in the following format: +```json +[ + { + "name": "topic1", + "partitions": 1, + "retentionMs": 86400000, + "cleanupPolicy": "delete" + }, + { "name": "topic2", + "partitions": 2, + "retentionMs": 86400000, + "cleanupPolicy": "delete" + } +] +``` + +A successful response will have HTTP status code 200 (OK) and contain an +array of JSON objects, where each object represents a Kafka topic and has the +following properties: + +| Property name | Description | +|-------------------|---------------------------------------------------------| +| name | The name of the Kafka topic. | +| partitions | The number of partitions of the Kafka topic. | +| retentionsMs | The retention period for messages on the topic (in ms). | +| cleanupPolicy | The cleanup policy of the Kafka topic. | + +#### Example + +```golang +func listTopics(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the ListTopicsOptions model + listTopicsOptionsModel := new(adminrestv1.ListTopicsOptions) + + // Call ListTopics. + result, response, operationErr := serviceAPI.ListTopics(listTopicsOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Topics" + operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusOK { + return fmt.Errorf("Error Listing Topics: status %d\n", response.StatusCode) + } + + // Loop and print topics. + for _, topicDetail := range result { + fmt.Printf("\tname: %s\n", *topicDetail.Name) + } + return nil +} +``` + +### Getting a Kafka topic +--- +To get a Kafka topic detail information, issue a GET request to the `/admin/topics/TOPICNAME` +path (where `TOPICNAME` is the name of the Kafka topic that you want to get). + +Expected status codes +- 200: Retrieve topic details successfully in following format: +```json +{ + "name": "MYTOPIC", + "partitions": 1, + "replicationFactor": 3, + "retentionMs": 86400000, + "cleanupPolicy": "delete", + "configs": { + "cleanup.policy": "delete", + "min.insync.replicas": "2", + "retention.bytes": "1073741824", + "retention.ms": "86400000", + "segment.bytes": "536870912" + }, + "replicaAssignments": [ + { + "id": 0, + "brokers": { + "replicas": [ + 3, + 2, + 4 + ] + } + } + ] +} +``` +- 403: Not authorized. +- 404: Topic does not exist. + +#### Example + +```golang +func topicDetails(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the GetTopicOptions model + getTopicOptionsModel := new(adminrestv1.GetTopicOptions) + getTopicOptionsModel.TopicName = core.StringPtr("test-topic") + + // Call List Topic Details. + result, response, operationErr := serviceAPI.GetTopic(getTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Topic Details" + operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusOK { + return fmt.Errorf("Error Listing Topic Details: status %d\n", response.StatusCode) + } + + // Print topics details. + fmt.Printf("\tname: \t\t\t%s\n", *result.Name) + + // The number of partitions. + fmt.Printf("\tno of partitions: \t%d\n", *result.Partitions) + + // The number of replication factor. + fmt.Printf("\treplication factor: \t%d\n", *result.ReplicationFactor) + + // // The value of config property 'retention.ms'. + fmt.Printf("\tretention (ms): \t%d\n", *result.RetentionMs) + + // // The value of config property 'cleanup.policy'. + fmt.Printf("\tcleanup policy: \t%s\n", *result.CleanupPolicy) + + // Configs *TopicConfigs + fmt.Printf("\ttopic configs: \t\t%+v\n", *result.Configs) + + // The replia assignment of the topic. + // ReplicaAssignments []ReplicaAssignment + for _, assignment := range result.ReplicaAssignments { + fmt.Printf("\tassignment: \t\tid:%d, \tbrokers: %+v\n", assignment.ID, assignment.Brokers) + } + + return nil + +} +``` + +### Updating Kafka topic's configuration +--- +To increase a Kafka topic's partition number or to update a Kafka topic's configuration, issue a +`PATCH` request to `/admin/topics/TOPICNAME` with the following body: +(where TOPICNAME is the name of the Kafka topic that you want to update). +```json +{ + "new_total_partition_count": 4, + "configs": [ + { + "name": "cleanup.policy", + "value": "compact" + } + ] +} +``` +Supported configuration keys are 'cleanup.policy', 'retention.ms', 'retention.bytes', 'segment.bytes', 'segment.ms', 'segment.index.bytes'. +And partition number can only be increased, not decreased. + +Expected status codes +- 202: Update topic request was accepted. +- 400: Invalid request JSON/number of partitions is invalid. +- 404: Topic specified does not exist. +- 422: Semantically invalid request. + +#### Example + +```golang +func updateTopicDetails(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the UpdateTopicOptions model + updateTopicOptionsModel := new(adminrestv1.UpdateTopicOptions) + updateTopicOptionsModel.TopicName = core.StringPtr("test-topic") + updateTopicOptionsModel.NewTotalPartitionCount = core.Int64Ptr(int64(6)) + + // Invoke operation with valid options model. + response, operationErr := serviceAPI.UpdateTopic(updateTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Updating Topic: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Updating Topics: status %d\n", response.StatusCode) + } + + fmt.Printf("\tname: %s updated\n", *updateTopicOptionsModel.TopicName) + + return nil +} +``` + +### List current mirroring topic selection + +Mirroring user controls are only available on the target cluster in a mirroring environment. + +To get the current topic selection, issue an GET request to /admin/mirroring/topic-selection + + +Expected status codes +- 200: Retrieved topic selection successfully in following format: +```json +{ + "includes": [ + "^prefix1_.*", + "^prefix2_.*" + ] +} +``` +- 403: Unauthorized to use mirroring user controls. +- 404: Mirroring not enabled. The mirroring user control APIs are only available on the target cluster of a mirrored pair. +- 503: An error occurred handling the request. + +#### Example + +```golang +func listMirroringTopicSelection(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the GetMirroringTopicSelectionOptions model + getMirroringTopicSelectionOptionsModel := new(adminrestv1.GetMirroringTopicSelectionOptions) + + // Call GetMirroringTopicSelection. + result, response, operationErr := serviceAPI.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Mirroring Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Listing Mirroring Topics: status %d\n", response.StatusCode) + } + + // Loop and print mirroring topics. + for _, topicName := range result.Includes { + fmt.Printf("\tname: %s\n", topicName) + } + + return nil +} +``` + +### Replace selection of topics which are mirrored + +Replace mirroring topic selection + +Mirroring user controls are available on the target cluster in a mirroring environment. + +To replace the current topic selection, issue a POST request to /admin/mirroring/topic-selection + +Expected status codes + +- 200: Replaced topic selection successfully. The new selection is returned in following format: +```json +{ + "includes": [ + "^prefix1_.*", + "^prefix2_.*" + ] +} +``` +- 400: Invalid request. The request data cannot be parsed and used to replace the topic selection. +- 403: Unauthorized to use mirroring user controls. +- 404: Mirroring not enabled. The mirroring user control APIs are only available on the target cluster of a mirrored pair. +- 415: Unsupported media type. Content-Type header with application/json is required. +- 503: An error occurred handling the request. + +#### Example + +```golang +func replaceMirroringTopicSelection(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the ReplaceMirroringTopicSelectionOptions model + replaceMirroringTopicSelectionOptionsModel := new(adminrestv1.ReplaceMirroringTopicSelectionOptions) + replaceMirroringTopicSelectionOptionsModel.Includes = []string{"test-topic"} + + // Invoke operation with valid options model. + result, response, operationErr := serviceAPI.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Replacing Mirroring Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Replacing Mirroring Topics: status %d\n", response.StatusCode) + } + + // Loop and print mirroring topics. + for _, topicName := range result.Includes { + fmt.Printf("\ttopic added: %s\n", topicName) + } + + return nil +} +``` + +### List active mirroring topics +--- +Mirroring user controls are available on the target cluster in a mirroring environment. + +To get the list of currently mirrored topics, issue an GET request to /admin/mirroring/active-topics + +Expected status codes + +- 200: Retrieved active topics successfully in following format: +```json +{ + "active_topics": [ + "topic1", + "topic2" + ] +} +``` +- 403: Unauthorized to use mirroring user controls. +- 404: Mirroring not enabled. The mirroring user control APIs are only available on the target cluster of a mirrored pair. +- 503: An error occurred handling the request. + +#### Example + +```golang +func getMirroringActiveTopics(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the GetMirroringActiveTopicsOptions model + getMirroringActiveTopicsOptionsModel := new(adminrestv1.GetMirroringActiveTopicsOptions) + + // Call GetMirroringActiveTopics. + result, response, operationErr := serviceAPI.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Active Mirroring Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Listing Active Mirroring Topics: status %d\n", response.StatusCode) + } + + // Loop and print mirroring topics. + for _, topicName := range result.ActiveTopics { + fmt.Printf("\tname: %s\n", topicName) + } + + return nil +} +``` diff --git a/admin-rest-api.yaml b/admin-rest-api.yaml new file mode 100644 index 0000000..d089996 --- /dev/null +++ b/admin-rest-api.yaml @@ -0,0 +1,966 @@ +# +# Copyright 2018, 2019 IBM +# +# Eclipse Public License - v 1.0 +# +#THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC +#LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM +#CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +swagger: '2.0' + +info: + version: 1.1.0 + title: IBM Event Streams Admin REST API + description: The administration REST API for IBM Event Streams on Cloud. + x-alternate-name: adminrest + +securityDefinitions: + APIKeyAuth: + type: apiKey + in: header + name: X-Auth-Token + description: > + A valid API key is required to access this API. API keys can be allocated + via the IBM Cloud interface, and are associated with an instance of the + Event Streams service. API key values must be supplied on every REST request + using the `X-Auth-Token` HTTP header. Failure to specify a valid API key + will result in the REST request failing with a 401 (Unauthorized) status + code. `X-Auth-Token` header is deprecated, `Authorization` header is recommanded. + TokenAuth: + type: apiKey + in: header + name: Authorization + description: > + A valid token or API key is required to access this API. API keys can be allocated + via the IBM Cloud interface, and are associated with an instance of the + Event Streams service. Token is obtained upon login to IBM Cloud and is associated with + the identity of the user. Either token or API key must be supplied on every REST request + using the `Authorization` `Bearer ${TokenOrAPIKey}` HTTP header. Failure to do so will + result in the REST request failing with a 401 (Unauthorized) status code. + BasicAuth: + type: basic + description: > + To use basic authentication, the HTTP header name is `Authorization`, value is + `Basic . + For both enterprise and standard plan, user name is `token`, password is API key. + +schemes: + - https +consumes: + - application/json +produces: + - application/json + +paths: + +#====================================================================================# +# APIs for managing topics +#====================================================================================# + /admin/topics: + #============================== + # POST /topics + #============================== + post: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: CreateTopic + summary: Create a new topic. + description: Create a new topic. + x-sdk-tags: + - Topic Operations + consumes: + - application/json + parameters: + - $ref: '#/parameters/topic_create' + responses: + 202: + description: > + Topic creation request accepted. Topic creation occurs + asynchronously, and therefore invoking the list topics REST endpoint + may not immediately show newly created topics. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + Strict-Transport-Security: + type: string + default: max-age=31536000; includeSubDomains + description: > + Specifies a period of time during which the user agent should only access the server using secure HTTPS connections. + Cache-Control: + type: string + default: no-cache, no-store + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + And the cache should not store anything about the client request or server response. + Pragma: + type: string + default: no-cache + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + Same as 'Cache-Control: no-cache'. It is used for backwards compatibility with HTTP/1.0. + schema: + $ref: '#/definitions/empty' + 400: + $ref: '#/responses/bad_request' + 401: + $ref: '#/responses/unauthorized' + 403: + $ref: '#/responses/forbidden' + 422: + $ref: '#/responses/unprocessable_entity' + 503: + $ref: '#/responses/service_unavailable' + + x-sdk-operations: + request-examples: + curl: + - name: "Example create topic using Curl." + example: + - type: "code" + source: "__CURL_CREATE_TOPIC_EXAMPLE__" + go: + - name: "Example create topic using Go." + example: + - type: "code" + source: "__GOLANG_CREATE_TOPIC_EXAMPLE__" + java: + - name: "Example create topic using Java." + example: + - type: "code" + source: "__JAVA_CREATE_TOPIC_EXAMPLE__" + python: + - name: "Example create topic using Python." + example: + - type: "code" + source: "__PYTHON_CREATE_TOPIC_EXAMPLE__" + node: + - name: "Example create topic using Node." + example: + - type: "code" + source: "__NODE_CREATE_TOPIC_EXAMPLE__" + + #============================== + # GET /topics + #============================== + get: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: ListTopics + summary: Get a list of topics. + description: > + 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. + x-sdk-tags: + - Topic Operations + parameters: + - $ref: '#/parameters/topic_filter' + - $ref: '#/parameters/per_page' + - $ref: '#/parameters/page' + responses: + 200: + description: > + Success. A list of topic information objects is returned in the + response body. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + Strict-Transport-Security: + type: string + default: max-age=31536000; includeSubDomains + description: > + Specifies a period of time during which the user agent should only access the server using secure HTTPS connections. + Cache-Control: + type: string + default: no-cache, no-store + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + And the cache should not store anything about the client request or server response. + Pragma: + type: string + default: no-cache + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + Same as 'Cache-Control: no-cache'. It is used for backwards compatibility with HTTP/1.0. + X-Total-Count: + type: integer + description: The total number of topics available. + Link: + type: string + description: > + The client can scroll through pages using the links generated in the Link header. + There are 4 links encoded in the header which represent the first, last, next and + previous operations. An example header is Link: + ; rel="next", + ; rel="first", + ; rel="last" + schema: + $ref: '#/definitions/topic_list' + 401: + $ref: '#/responses/unauthorized' + 503: + $ref: '#/responses/service_unavailable' + x-sdk-operations: + request-examples: + curl: + - name: "Example lists topics using Curl." + example: + - type: "code" + source: "__CURL_LIST_TOPIC_EXAMPLE__" + go: + - name: "Example lists topics using Go." + example: + - type: "code" + source: "__GOLANG_LIST_TOPIC_EXAMPLE__" + java: + - name: "Example lists topics using Java." + example: + - type: "code" + source: "__JAVA_LIST_TOPIC_EXAMPLE__" + python: + - name: "Example lists topics using Python." + example: + - type: "code" + source: "__PYTHON_LIST_TOPIC_EXAMPLE__" + node: + - name: "Example lists topics using Node." + example: + - type: "code" + source: "__NODE_LIST_TOPIC_EXAMPLE__" + + + /admin/topics/{topic_name}: + #================================== + # GET /admin/topics/{topic_name} + #================================== + get: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: GetTopic + summary: Get detailed information on a topic. + description: Get detailed information on a topic. + x-sdk-tags: + - Topic Operations + parameters: + - $ref: '#/parameters/topic_name' + responses: + 200: + description: Returns a detailed description of a single topic. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + Strict-Transport-Security: + type: string + default: max-age=31536000; includeSubDomains + description: > + Specifies a period of time during which the user agent should only access the server using secure HTTPS connections. + Cache-Control: + type: string + default: no-cache, no-store + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + And the cache should not store anything about the client request or server response. + Pragma: + type: string + default: no-cache + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + Same as 'Cache-Control: no-cache'. It is used for backwards compatibility with HTTP/1.0. + schema: + $ref: '#/definitions/topic_detail' + 401: + $ref: '#/responses/unauthorized' + 404: + $ref: '#/responses/not_found' + 503: + $ref: '#/responses/service_unavailable' + x-sdk-operations: + request-examples: + curl: + - name: "Example get topic details using Curl." + example: + - type: "code" + source: "__CURL_TOPIC_DETAILS_EXAMPLE__" + go: + - name: "Example get topic details using Go." + example: + - type: "code" + source: "__GOLANG_TOPIC_DETAILS_EXAMPLE__" + java: + - name: "Example get topic details using Java." + example: + - type: "code" + source: "__JAVA_TOPIC_DETAILS_EXAMPLE__" + python: + - name: "Example get topic details using Python." + example: + - type: "code" + source: "__PYTHON_TOPIC_DETAILS_EXAMPLE__" + node: + - name: "Example get topic details using Node." + example: + - type: "code" + source: "__NODE_TOPIC_DETAILS_EXAMPLE__" + + + #================================== + # DELETE /admin/topics/{topic_name} + #================================== + delete: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: DeleteTopic + summary: Delete a topic. + description: Delete a topic. + x-sdk-tags: + - Topic Operations + parameters: + - $ref: '#/parameters/topic_name' + responses: + 202: + description: > + The Topic delete request accepted. The Kafka topic deletion process + occurs asynchronously. Duplicate deletion requests for a topic which + is in the process of being deleted will return this status code. + Requests to delete a non-existent topic will also return this status + code. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + Strict-Transport-Security: + type: string + default: max-age=31536000; includeSubDomains + description: > + Specifies a period of time during which the user agent should only access the server using secure HTTPS connections. + Cache-Control: + type: string + default: no-cache, no-store + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + And the cache should not store anything about the client request or server response. + Pragma: + type: string + default: no-cache + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + Same as 'Cache-Control: no-cache'. It is used for backwards compatibility with HTTP/1.0. + schema: + $ref: '#/definitions/empty' + 401: + $ref: '#/responses/unauthorized' + 403: + $ref: '#/responses/forbidden' + 404: + $ref: '#/responses/not_found' + 503: + $ref: '#/responses/service_unavailable' + x-sdk-operations: + request-examples: + curl: + - name: "Example delete topic using Curl." + example: + - type: "code" + source: "__CURL_DELETE_TOPIC_EXAMPLE__" + go: + - name: "Example delete topic using Go." + example: + - type: "code" + source: "__GOLANG_DELETE_TOPIC_EXAMPLE__" + java: + - name: "Example delete topic using Java." + example: + - type: "code" + source: "__JAVA_DELETE_TOPIC_EXAMPLE__" + python: + - name: "Example delete topic using Python." + example: + - type: "code" + source: "__PYTHON_DELETE_TOPIC_EXAMPLE__" + node: + - name: "Example delete topic using Node." + example: + - type: "code" + source: "__NODE_DELETE_TOPIC_EXAMPLE__" + + + #================================= + # PATCH /admin/topics/{topic_name} + #================================= + patch: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: UpdateTopic + summary: > + Increase the number of partitions and/or update one or more topic configuration parameters. + description: > + Increase the number of partitions and/or update one or more topic configuration parameters. + x-sdk-tags: + - Topic Operations + consumes: + - application/json + parameters: + - $ref: '#/parameters/topic_name' + - $ref: '#/parameters/topic_update' + responses: + 202: + description: Request was accepted. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + Strict-Transport-Security: + type: string + default: max-age=31536000; includeSubDomains + description: > + Specifies a period of time during which the user agent should only access the server using secure HTTPS connections. + Cache-Control: + type: string + default: no-cache, no-store + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + And the cache should not store anything about the client request or server response. + Pragma: + type: string + default: no-cache + description: > + Forces caches to submit the request to the origin server for validation before releasing a cached copy. + Same as 'Cache-Control: no-cache'. It is used for backwards compatibility with HTTP/1.0. + schema: + $ref: '#/definitions/empty' + 400: + $ref: '#/responses/bad_request' + 401: + $ref: '#/responses/unauthorized' + 403: + $ref: '#/responses/forbidden' + 404: + $ref: '#/responses/not_found' + 422: + $ref: '#/responses/unprocessable_entity' + 503: + $ref: '#/responses/service_unavailable' + x-sdk-operations: + request-examples: + curl: + - name: "Example update topic using Curl." + example: + - type: "code" + source: "__CURL_UPDATE_TOPIC_EXAMPLE__" + go: + - name: "Example update topic using Go." + example: + - type: "code" + source: "__GOLANG_UPDATE_TOPIC_EXAMPLE__" + java: + - name: "Example update topic using Java." + example: + - type: "code" + source: "__JAVA_UPDATE_TOPIC_EXAMPLE__" + python: + - name: "Example update topic using Python." + example: + - type: "code" + source: "__PYTHON_UPDATE_TOPIC_EXAMPLE__" + node: + - name: "Example update topic using Node." + example: + - type: "code" + source: "__NODE_UPDATE_TOPIC_EXAMPLE__" + + + '/admin/mirroring/topic-selection': + #===================================== + # GET /admin/mirroring/topic-selection + #===================================== + get: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: GetMirroringTopicSelection + summary: Get current topic selection for mirroring. + description: Get current topic selection for mirroring. + x-sdk-tags: + - Mirroring Operations + parameters: [] + responses: + 200: + description: Returns topic selections as patterns. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + schema: + $ref: '#/definitions/mirroring_topic_selection' + 401: + $ref: '#/responses/unauthorized' + 403: + $ref: '#/responses/forbidden' + 503: + $ref: '#/responses/service_unavailable' + x-sdk-operations: + request-examples: + curl: + - name: "Example get mirroring topic selection using Curl." + example: + - type: "code" + source: "__CURL_GET_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + go: + - name: "Example get mirroring topic selection using Go." + example: + - type: "code" + source: "__GOLANG_GET_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + java: + - name: "Example get mirroring topic selection using Java." + example: + - type: "code" + source: "__JAVA_GET_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + python: + - name: "Example get mirroring topic selection using Python." + example: + - type: "code" + source: "__PYTHON_GET_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + node: + - name: "Example get mirroring topic selection using Node." + example: + - type: "code" + source: "__NODE_GET_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + + + #===================================== + # POST /admin/mirroring/topic-selection + #===================================== + post: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: ReplaceMirroringTopicSelection + summary: Replace topic selection for mirroring. + description: Replace topic selection for mirroring. This operation replaces the complete set of mirroring topic selections. + x-sdk-tags: + - Mirroring Operations + parameters: + - $ref: '#/parameters/mirroring_topic_selection_replacement' + responses: + 200: + description: Returns new topic selections as patterns. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + schema: + $ref: '#/definitions/mirroring_topic_selection' + 400: + $ref: '#/responses/bad_request' + 401: + $ref: '#/responses/unauthorized' + 403: + $ref: '#/responses/forbidden' + 415: + $ref: '#/responses/unsupported_media_type' + 503: + $ref: '#/responses/service_unavailable' + x-sdk-operations: + request-examples: + curl: + - name: "Example replace mirroring topic selection using Curl." + example: + - type: "code" + source: "__CURL_REPLACE_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + go: + - name: "Example replace mirroring topic selection using Go." + example: + - type: "code" + source: "__GOLANG_REPLACE_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + java: + - name: "Example replace mirroring topic selection using Java." + example: + - type: "code" + source: "__JAVA_REPLACE_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + python: + - name: "Example replace mirroring topic selection using Python." + example: + - type: "code" + source: "__PYTHON_REPLACE_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + node: + - name: "Example replace mirroring topic selection using Node." + example: + - type: "code" + source: "__NODE_REPLACE_MIRRORING_TOPIC_SELECTION_EXAMPLE__" + + + '/admin/mirroring/active-topics': + #===================================== + # GET /admin/mirroring/active-topics + #===================================== + get: + security: + - APIKeyAuth: [] + - TokenAuth: [] + - BasicAuth: [] + operationId: GetMirroringActiveTopics + summary: Get topics that are being actively mirrored. + description: Get topics that are being actively mirrored. + x-sdk-tags: + - Mirroring Operations + parameters: [] + responses: + 200: + description: Return topics that are being actively mirrored. + headers: + X-Global-Transaction-Id: + type: string + description: > + The transaction ID of the request for debugging purpose. + If the header is set on the request, it will be honored. If not, it will be generated. + In the event of a non-200 error return code, the transaction ID is also returned in the JSON error response as 'incident_id'. + schema: + $ref: '#/definitions/mirroring_active_topics' + 401: + $ref: '#/responses/unauthorized' + 403: + $ref: '#/responses/forbidden' + 404: + $ref: '#/responses/not_found' + 503: + $ref: '#/responses/service_unavailable' + x-sdk-operations: + request-examples: + curl: + - name: "Example get mirroring active topics using Curl." + example: + - type: "code" + source: "__CURL_GET_MIRRORING_ACTIVE_TOPICS_EXAMPLE__" + go: + - name: "Example get mirroring active topics using Go." + example: + - type: "code" + source: "__GOLANG_GET_MIRRORING_ACTIVE_TOPICS_EXAMPLE__" + java: + - name: "Example get mirroring active topics using Java." + example: + - type: "code" + source: "__JAVA_GET_MIRRORING_ACTIVE_TOPICS_EXAMPLE__" + python: + - name: "Example get mirroring active topics using Python." + example: + - type: "code" + source: "__PYTHON_GET_MIRRORING_ACTIVE_TOPICS_EXAMPLE__" + node: + - name: "Example get mirroring active topics using Node." + example: + - type: "code" + source: "__NODE_GET_MIRRORING_ACTIVE_TOPICS_EXAMPLE__" + + +definitions: + empty: + type: object + description: Expected empty response could be {}. + + error: + type: object + properties: + error_code: + type: integer + description: The 3-digits http status code plus 2-digits kafka error code. + message: + type: string + description: The error message. + incident_id: + type: string + description: The incident ID of the error. + + topic_create_request: + type: object + properties: + name: + type: string + description: The name of topic to be created. + partitions: + type: integer + format: int64 + description: The number of partitions. + partition_count: + type: integer + format: int64 + description: The number of partitions, this field takes precedence over 'partitions'. Default value is 1 if not specified. + default: 1 + minimum: 1 + maximum: 1000 + configs: + type: array + description: The config properties to be set for the new topic. + items: + $ref: '#/definitions/config_create' + + config_create: + type: object + properties: + name: + type: string + description: The name of the config property. + value: + type: string + description: The value for a config property. + + config_update: + type: object + properties: + name: + type: string + description: The name of the config property. + value: + type: string + description: The value for a config property. + reset_to_default: + type: boolean + description: When true, the value of the config property is reset to its default value. + + topic_update_request: + type: object + properties: + new_total_partition_count: + type: integer + format: int32 + description: The new partition number to be increased. + configs: + type: array + description: > + 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'. + items: + $ref: '#/definitions/config_update' + + topic_list: + description: A list of 'topic_detail' is returned. + type: array + items: + $ref: '#/definitions/topic_detail' + + topic_detail: + type: object + properties: + name: + type: string + description: The name of the topic. + partitions: + type: integer + description: The number of partitions. + replicationFactor: + type: integer + description: The number of replication factor. + retentionMs: + type: integer + description: The value of config property 'retention.ms'. + cleanupPolicy: + type: string + description: The value of config property 'cleanup.policy'. + configs: + $ref: '#/definitions/topic_configs' + replicaAssignments: + type: array + description: The replia assignment of the topic. + items: + $ref: '#/definitions/replica_assignment' + + topic_configs: + type: object + properties: + cleanup.policy: + type: string + description: The value of config property 'cleanup.policy'. + min.insync.replicas: + type: string + description: The value of config property 'min.insync.replicas' + retention.bytes: + type: string + description: The value of config property 'retention.bytes'. + retention.ms: + type: string + description: The value of config property 'retention.ms' + segment.bytes: + type: string + description: The value of config property 'segment.bytes'. + segment.index.bytes: + type: string + description: The value of config property 'segment.index.bytes'. + segment.ms: + type: string + description: The value of config property 'segment.ms'. + + replica_assignment: + type: object + properties: + id: + type: integer + description: The ID of the partition. + brokers: + type: object + properties: + replicas: + type: array + items: + type: integer + description: The IDs of replicas of the partition. + + topic_selection_pattern: + type: string + description: Mirroring topic selection pattern. + + mirroring_topic_selection: + type: object + description: Mirroring topic selection payload. + properties: + includes: + type: array + items: + $ref: '#/definitions/topic_selection_pattern' + + active_topic: + type: string + description: Active mirroring topic. + + mirroring_active_topics: + type: object + description: Topics that are being actively mirrored. + properties: + active_topics: + type: array + items: + $ref: '#/definitions/active_topic' + +# Descriptions of common parameters +parameters: + topic_filter: + name: topic_filter + in: query + required: false + type: string + description: > + 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.* /`. + + per_page: + name: per_page + in: query + required: false + type: integer + description: The number of topic names to be returns. + + page: + name: page + in: query + required: false + type: integer + description: > + The page number to be returned. The number 1 represents the first page. The default value is 1. + + topic_create: + name: topic_create + in: body + required: true + description: The new topic to be created. + schema: + $ref: '#/definitions/topic_create_request' + + topic_name: + name: topic_name + in: path + type: string + required: true + description: The topic name for the topic to be listed. + + topic_update: + name: topic_update + in: body + required: true + description: The new partition number or the configurations to be updated for the topic. + schema: + $ref: '#/definitions/topic_update_request' + + mirroring_topic_selection_replacement: + name: mirroring_topic_selection_replacement + in: body + required: true + description: Topic selection patterns for mirroring. + schema: + $ref: '#/definitions/mirroring_topic_selection' + +# Descriptions of common responses +responses: + service_unavailable: + description: Service was unavailable. + schema: + $ref: '#/definitions/error' + + not_found: + description: The requested resource was not found. + schema: + $ref: '#/definitions/error' + + unauthorized: + description: Authentication information was missing or bad. + schema: + $ref: '#/definitions/error' + + forbidden: + description: Not authorized to perform the operation. + schema: + $ref: '#/definitions/error' + + bad_request: + description: The request body was invalid JSON. + schema: + $ref: '#/definitions/error' + + unprocessable_entity: + description: The server was not able to process the request body. + schema: + $ref: '#/definitions/error' + + unsupported_media_type: + description: Unsupported Content-Type provided. + schema: + $ref: '#/definitions/error' \ No newline at end of file diff --git a/build/publishCodeCoverage.sh b/build/publishCodeCoverage.sh new file mode 100755 index 0000000..6b283fa --- /dev/null +++ b/build/publishCodeCoverage.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# This script will publish code coverage info for a build of the main branch +# or a tagged release. + +if [[ -n "${TRAVIS_TAG}" || "${TRAVIS_BRANCH}" == "main" && "${TRAVIS_PULL_REQUEST}" == "false" ]]; then + printf ">>>>> Publishing code coverage info for branch: %s\n" ${TRAVIS_BRANCH} + $HOME/codecov-bash.sh -f coverage.txt -t $CODECOV_TOKEN +else + printf ">>>>> Bypassing code coverage publish step for feature branch/PR build.\n" +fi diff --git a/cover.out b/cover.out new file mode 100644 index 0000000..6c38ac9 --- /dev/null +++ b/cover.out @@ -0,0 +1,697 @@ +mode: atomic +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:56.105,57.31 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:61.2,61.34 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:68.2,69.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:73.2,74.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:78.2,78.23 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:81.2,81.8 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:57.31,59.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:61.34,63.17 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:63.17,65.4 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:69.16,71.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:74.16,76.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:78.23,80.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:85.84,92.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:96.2,96.23 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:103.2,107.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:92.16,94.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:96.23,98.17 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:98.17,100.4 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:111.60,113.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:116.52,117.27 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:120.2,122.15 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:117.27,119.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:126.63,128.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:131.54,133.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:136.70,138.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:141.73,143.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:146.63,148.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:152.93,154.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:157.48,159.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:163.128,165.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:168.160,170.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:173.2,174.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:178.2,182.16 5 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:186.2,186.66 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:190.2,191.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:194.2,198.36 4 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:201.2,201.42 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:204.2,204.46 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:207.2,207.39 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:210.2,211.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:215.2,216.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:220.2,222.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:170.16,172.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:174.16,176.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:182.16,184.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:186.66,188.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:191.50,193.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:198.36,200.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:201.42,203.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:204.46,206.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:207.39,209.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:211.16,213.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:216.16,218.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:228.147,230.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:233.179,235.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:239.2,243.16 5 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:247.2,247.65 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:251.2,252.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:255.2,257.42 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:260.2,260.38 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:263.2,263.35 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:267.2,268.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:272.2,274.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:277.2,278.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:281.2,283.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:235.16,237.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:243.16,245.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:247.65,249.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:252.50,254.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:257.42,259.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:260.38,262.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:263.35,265.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:268.16,270.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:274.16,276.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:278.16,280.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:288.140,290.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:293.172,295.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:298.2,299.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:303.2,311.16 6 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:315.2,315.63 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:319.2,320.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:323.2,326.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:330.2,332.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:335.2,336.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:339.2,341.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:295.16,297.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:299.16,301.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:311.16,313.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:315.63,317.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:320.50,322.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:326.16,328.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:332.16,334.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:336.16,338.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:346.128,348.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:351.160,353.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:356.2,357.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:361.2,369.16 6 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:373.2,373.66 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:377.2,378.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:381.2,384.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:388.2,390.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:353.16,355.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:357.16,359.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:369.16,371.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:373.66,375.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:378.50,380.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:384.16,386.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:395.128,397.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:400.160,402.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:405.2,406.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:410.2,418.16 6 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:422.2,422.66 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:426.2,427.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:430.2,434.54 4 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:437.2,437.39 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:440.2,441.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:445.2,446.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:450.2,452.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:402.16,404.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:406.16,408.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:418.16,420.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:422.66,424.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:427.50,429.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:434.54,436.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:437.39,439.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:441.16,443.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:446.16,448.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:457.206,459.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:462.238,464.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:468.2,472.16 5 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:476.2,476.81 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:480.2,481.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:484.2,487.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:491.2,493.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:496.2,497.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:500.2,502.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:464.16,466.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:472.16,474.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:476.81,478.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:481.50,483.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:487.16,489.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:493.16,495.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:497.16,499.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:507.218,509.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:512.250,514.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:517.2,518.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:522.2,526.16 5 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:530.2,530.85 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:534.2,535.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:538.2,542.59 4 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:545.2,546.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:550.2,551.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:555.2,557.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:560.2,561.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:564.2,566.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:514.16,516.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:518.16,520.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:526.16,528.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:530.85,532.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:535.50,537.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:542.59,544.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:546.16,548.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:551.16,553.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:557.16,559.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:561.16,563.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:571.198,573.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:576.230,578.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:582.2,586.16 5 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:590.2,590.79 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:594.2,595.50 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:598.2,601.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:605.2,607.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:610.2,611.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:614.2,616.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:578.16,580.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:586.16,588.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:590.79,592.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:595.50,597.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:601.16,603.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:607.16,609.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:611.16,613.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:638.65,640.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:643.77,646.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:649.88,652.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:655.96,658.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:661.91,664.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:667.92,670.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:682.81,686.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:689.87,692.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:695.92,698.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:708.91,710.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:713.118,716.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:726.95,728.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:731.122,734.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:746.75,750.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:753.81,756.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:759.86,762.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:783.63,785.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:788.89,791.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:794.80,797.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:800.74,803.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:806.90,809.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:820.103,822.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:825.125,828.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:831.130,834.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:842.102,845.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:848.2,849.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:845.16,847.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:869.81,873.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:876.87,879.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:882.112,885.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:888.91,891.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:894.92,897.2 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:909.90,912.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:915.2,916.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:919.2,920.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:912.16,914.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:916.16,918.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:936.90,939.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:942.2,943.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:946.2,947.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:950.2,951.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:939.16,941.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:943.16,945.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:947.16,949.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:960.99,963.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:966.2,967.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:963.16,965.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:976.101,979.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:982.2,983.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:979.16,981.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:995.95,998.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1001.2,1002.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1005.2,1006.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:998.16,1000.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1002.16,1004.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1034.90,1037.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1040.2,1041.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1044.2,1045.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1048.2,1049.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1052.2,1053.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1056.2,1057.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1060.2,1061.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1064.2,1065.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1037.16,1039.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1041.16,1043.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1045.16,1047.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1049.16,1051.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1053.16,1055.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1057.16,1059.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1061.16,1063.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1092.89,1095.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1098.2,1099.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1102.2,1103.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1106.2,1107.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1110.2,1111.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1114.2,1115.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1118.2,1119.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1122.2,1123.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1095.16,1097.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1099.16,1101.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1103.16,1105.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1107.16,1109.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1111.16,1113.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1115.16,1117.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1119.16,1121.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:28.13,33.15 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:38.2,38.39 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:43.2,43.39 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:48.2,50.18 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:70.2,76.23 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:82.2,87.16 5 0 +github.com/IBM/eventstreams-go-sdk/example.go:92.2,94.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:99.2,101.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:106.2,108.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:113.2,115.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:120.2,122.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:149.2,151.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:156.2,158.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:33.15,36.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:38.39,41.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:43.39,46.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:50.18,54.17 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:54.17,57.4 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:58.8,62.17 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:62.17,65.4 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:76.23,79.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:87.16,90.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:94.16,97.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:101.16,104.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:108.16,111.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:115.16,118.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:122.16,125.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:151.16,154.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:158.16,161.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:164.60,170.25 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:175.2,175.42 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:180.2,180.37 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:183.2,183.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:170.25,172.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:175.42,177.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:180.37,182.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:186.62,193.25 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:198.2,198.42 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:203.2,222.55 7 0 +github.com/IBM/eventstreams-go-sdk/example.go:226.2,226.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:193.25,195.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:198.42,200.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:222.55,224.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:230.61,238.25 5 0 +github.com/IBM/eventstreams-go-sdk/example.go:243.2,243.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:247.2,249.12 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:238.25,240.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:243.48,245.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:252.61,259.25 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:264.2,264.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:268.2,269.12 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:259.25,261.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:264.48,266.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:272.68,280.25 5 0 +github.com/IBM/eventstreams-go-sdk/example.go:285.2,285.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:289.2,291.12 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:280.25,282.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:285.48,287.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:295.80,302.25 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:307.2,307.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:312.2,312.44 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:316.2,316.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:302.25,304.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:307.48,309.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:312.44,314.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:320.77,326.25 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:331.2,331.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:336.2,336.44 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:340.2,340.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:326.25,328.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:331.48,333.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:336.44,338.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:344.74,350.25 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:355.2,355.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:360.2,360.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:364.2,364.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:350.25,352.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:355.48,357.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:360.48,362.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/common/headers.go:64.101,70.2 3 1 +github.com/IBM/eventstreams-go-sdk/pkg/common/headers.go:74.32,76.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/common/headers.go:80.29,82.2 1 2 +github.com/IBM/eventstreams-go-sdk/pkg/common/headers.go:64.101,70.2 3 33 +github.com/IBM/eventstreams-go-sdk/pkg/common/headers.go:74.32,76.2 1 33 +github.com/IBM/eventstreams-go-sdk/pkg/common/headers.go:80.29,82.2 1 1 +github.com/IBM/eventstreams-go-sdk/example.go:28.13,33.15 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:38.2,38.39 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:43.2,43.39 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:48.2,50.18 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:70.2,76.23 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:82.2,87.16 5 0 +github.com/IBM/eventstreams-go-sdk/example.go:92.2,94.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:99.2,101.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:106.2,108.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:113.2,115.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:120.2,122.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:149.2,151.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:156.2,158.16 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:33.15,36.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:38.39,41.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:43.39,46.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:50.18,54.17 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:54.17,57.4 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:58.8,62.17 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:62.17,65.4 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:76.23,79.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:87.16,90.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:94.16,97.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:101.16,104.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:108.16,111.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:115.16,118.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:122.16,125.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:151.16,154.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:158.16,161.3 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:164.60,170.25 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:175.2,175.42 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:180.2,180.37 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:183.2,183.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:170.25,172.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:175.42,177.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:180.37,182.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:186.62,193.25 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:198.2,198.42 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:203.2,222.55 7 0 +github.com/IBM/eventstreams-go-sdk/example.go:226.2,226.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:193.25,195.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:198.42,200.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:222.55,224.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:230.61,238.25 5 0 +github.com/IBM/eventstreams-go-sdk/example.go:243.2,243.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:247.2,249.12 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:238.25,240.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:243.48,245.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:252.61,259.25 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:264.2,264.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:268.2,269.12 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:259.25,261.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:264.48,266.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:272.68,280.25 5 0 +github.com/IBM/eventstreams-go-sdk/example.go:285.2,285.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:289.2,291.12 2 0 +github.com/IBM/eventstreams-go-sdk/example.go:280.25,282.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:285.48,287.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:295.80,302.25 4 0 +github.com/IBM/eventstreams-go-sdk/example.go:307.2,307.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:312.2,312.44 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:316.2,316.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:302.25,304.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:307.48,309.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:312.44,314.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:320.77,326.25 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:331.2,331.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:336.2,336.44 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:340.2,340.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:326.25,328.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:331.48,333.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:336.44,338.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:344.74,350.25 3 0 +github.com/IBM/eventstreams-go-sdk/example.go:355.2,355.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:360.2,360.48 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:364.2,364.12 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:350.25,352.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:355.48,357.3 1 0 +github.com/IBM/eventstreams-go-sdk/example.go:360.48,362.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:56.105,57.31 1 5 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:61.2,61.34 1 5 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:68.2,69.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:73.2,74.16 2 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:78.2,78.23 1 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:81.2,81.8 1 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:57.31,59.3 1 5 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:61.34,63.17 2 5 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:63.17,65.4 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:69.16,71.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:74.16,76.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:78.23,80.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:85.84,92.16 3 34 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:96.2,96.23 1 32 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:103.2,107.8 2 31 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:92.16,94.3 1 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:96.23,98.17 2 29 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:98.17,100.4 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:111.60,113.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:116.52,117.27 1 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:120.2,122.15 3 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:117.27,119.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:126.63,128.2 1 9 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:131.54,133.2 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:136.70,138.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:141.73,143.2 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:146.63,148.2 1 41 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:152.93,154.2 1 10 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:157.48,159.2 1 5 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:163.128,165.2 1 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:168.160,170.16 2 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:173.2,174.16 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:178.2,182.16 5 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:186.2,186.66 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:190.2,191.50 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:194.2,198.36 4 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:201.2,201.42 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:204.2,204.46 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:207.2,207.39 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:210.2,211.16 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:215.2,216.16 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:220.2,222.8 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:170.16,172.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:174.16,176.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:182.16,184.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:186.66,188.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:191.50,193.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:198.36,200.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:201.42,203.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:204.46,206.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:207.39,209.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:211.16,213.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:216.16,218.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:228.147,230.2 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:233.179,235.16 2 8 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:239.2,243.16 5 7 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:247.2,247.65 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:251.2,252.50 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:255.2,257.42 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:260.2,260.38 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:263.2,263.35 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:267.2,268.16 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:272.2,274.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:277.2,278.16 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:281.2,283.8 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:235.16,237.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:243.16,245.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:247.65,249.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:252.50,254.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:257.42,259.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:260.38,262.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:263.35,265.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:268.16,270.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:274.16,276.3 1 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:278.16,280.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:288.140,290.2 1 7 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:293.172,295.16 2 9 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:298.2,299.16 2 8 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:303.2,311.16 6 7 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:315.2,315.63 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:319.2,320.50 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:323.2,326.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:330.2,332.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:335.2,336.16 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:339.2,341.8 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:295.16,297.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:299.16,301.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:311.16,313.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:315.63,317.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:320.50,322.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:326.16,328.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:332.16,334.3 1 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:336.16,338.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:346.128,348.2 1 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:351.160,353.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:356.2,357.16 2 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:361.2,369.16 6 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:373.2,373.66 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:377.2,378.50 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:381.2,384.16 3 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:388.2,390.8 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:353.16,355.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:357.16,359.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:369.16,371.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:373.66,375.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:378.50,380.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:384.16,386.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:395.128,397.2 1 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:400.160,402.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:405.2,406.16 2 3 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:410.2,418.16 6 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:422.2,422.66 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:426.2,427.50 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:430.2,434.54 4 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:437.2,437.39 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:440.2,441.16 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:445.2,446.16 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:450.2,452.8 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:402.16,404.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:406.16,408.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:418.16,420.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:422.66,424.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:427.50,429.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:434.54,436.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:437.39,439.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:441.16,443.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:446.16,448.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:457.206,459.2 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:462.238,464.16 2 8 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:468.2,472.16 5 7 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:476.2,476.81 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:480.2,481.50 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:484.2,487.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:491.2,493.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:496.2,497.16 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:500.2,502.8 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:464.16,466.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:472.16,474.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:476.81,478.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:481.50,483.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:487.16,489.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:493.16,495.3 1 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:497.16,499.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:507.218,509.2 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:512.250,514.16 2 8 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:517.2,518.16 2 7 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:522.2,526.16 5 7 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:530.2,530.85 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:534.2,535.50 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:538.2,542.59 4 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:545.2,546.16 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:550.2,551.16 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:555.2,557.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:560.2,561.16 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:564.2,566.8 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:514.16,516.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:518.16,520.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:526.16,528.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:530.85,532.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:535.50,537.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:542.59,544.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:546.16,548.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:551.16,553.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:557.16,559.3 1 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:561.16,563.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:571.198,573.2 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:576.230,578.16 2 8 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:582.2,586.16 5 7 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:590.2,590.79 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:594.2,595.50 2 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:598.2,601.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:605.2,607.16 3 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:610.2,611.16 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:614.2,616.8 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:578.16,580.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:586.16,588.3 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:590.79,592.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:595.50,597.3 1 6 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:601.16,603.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:607.16,609.3 1 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:611.16,613.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:638.65,640.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:643.77,646.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:649.88,652.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:655.96,658.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:661.91,664.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:667.92,670.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:682.81,686.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:689.87,692.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:695.92,698.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:708.91,710.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:713.118,716.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:726.95,728.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:731.122,734.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:746.75,750.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:753.81,756.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:759.86,762.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:783.63,785.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:788.89,791.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:794.80,797.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:800.74,803.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:806.90,809.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:820.103,822.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:825.125,828.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:831.130,834.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:842.102,845.16 3 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:848.2,849.8 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:845.16,847.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:869.81,873.2 1 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:876.87,879.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:882.112,885.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:888.91,891.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:894.92,897.2 2 1 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:909.90,912.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:915.2,916.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:919.2,920.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:912.16,914.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:916.16,918.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:936.90,939.16 3 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:942.2,943.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:946.2,947.16 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:950.2,951.8 2 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:939.16,941.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:943.16,945.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:947.16,949.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:960.99,963.16 3 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:966.2,967.8 2 2 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:963.16,965.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:976.101,979.16 3 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:982.2,983.8 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:979.16,981.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:995.95,998.16 3 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1001.2,1002.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1005.2,1006.8 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:998.16,1000.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1002.16,1004.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1034.90,1037.16 3 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1040.2,1041.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1044.2,1045.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1048.2,1049.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1052.2,1053.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1056.2,1057.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1060.2,1061.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1064.2,1065.8 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1037.16,1039.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1041.16,1043.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1045.16,1047.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1049.16,1051.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1053.16,1055.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1057.16,1059.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1061.16,1063.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1092.89,1095.16 3 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1098.2,1099.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1102.2,1103.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1106.2,1107.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1110.2,1111.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1114.2,1115.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1118.2,1119.16 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1122.2,1123.8 2 4 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1095.16,1097.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1099.16,1101.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1103.16,1105.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1107.16,1109.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1111.16,1113.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1115.16,1117.3 1 0 +github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1/adminrest_v1.go:1119.16,1121.3 1 0 diff --git a/example.go b/example.go new file mode 100644 index 0000000..e88f2eb --- /dev/null +++ b/example.go @@ -0,0 +1,365 @@ +/* + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package main + +// Code Setup +import ( + "fmt" + "net/http" + "os" + + "github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1" + "github.com/IBM/go-sdk-core/v4/core" +) + +// End Code Setup + +func main() { + URL := os.Getenv("KAFKA_ADMIN_URL") + apiKey := os.Getenv("API_KEY") + bearerToken := os.Getenv("BEARER_TOKEN") + + if URL == "" { + fmt.Println("Please set env KAFKA_ADMIN_URL") + os.Exit(1) + } + + if apiKey == "" && bearerToken == "" { + fmt.Println("Please set either an API_KEY or a BEARER_TOKEN") + os.Exit(1) + } + + if apiKey != "" && bearerToken != "" { + fmt.Println("Please set either an API_KEY or a BEARER_TOKEN not both") + os.Exit(1) + } + // Create Authenticator + var authenticator core.Authenticator + + if apiKey != "" { + var err error + // Create an Basic IAM authenticator. + authenticator, err = core.NewBasicAuthenticator("token", apiKey) + if err != nil { + fmt.Printf("failed to create new basic authenticator: %s\n", err.Error()) + os.Exit(1) + } + } else { + var err error + // Create an IAM Bearer Token authenticator. + authenticator, err = core.NewBearerTokenAuthenticator(bearerToken) + if err != nil { + fmt.Printf("failed to create new bearer token authenticator: %s\n", err.Error()) + os.Exit(1) + } + } + // End Authenticator + + // Create Service + serviceAPI, serviceErr := adminrestv1.NewAdminrestV1(&adminrestv1.AdminrestV1Options{ + URL: URL, + Authenticator: authenticator, + }) + // End Create Service + + if serviceErr != nil { + fmt.Printf("Error Creating Service") + os.Exit(1) + } + + // Always try to delete test-topic + fmt.Printf("Delete Topic\n") + _ = deleteTopic(serviceAPI) + + fmt.Printf("List Topics\n") + err := listTopics(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } + + fmt.Printf("Create Topic\n") + err = createTopic(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } + + fmt.Printf("Print Topic Details\n") + err = topicDetails(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } + + fmt.Printf("List Topics\n") + err = listTopics(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } + + fmt.Printf("Update Topic Details\n") + err = updateTopicDetails(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } + + fmt.Printf("Print Topic Details\n") + err = topicDetails(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } + + // Uncomment these examples if you are running against a Event Streams Mirrored Target Cluster. + // fmt.Printf("List Active Mirroring Topics\n") + // err = getMirroringActiveTopics(serviceAPI) + // if err != nil { + // fmt.Printf("%s\n", err.Error()) + // os.Exit(1) + // } + + // fmt.Printf("Replace Mirroring Topics\n") + // err = replaceMirroringTopicSelection(serviceAPI) + // if err != nil { + // fmt.Printf("%s\n", err.Error()) + // os.Exit(1) + // } + + // fmt.Printf("List Mirroring Topic Selection\n") + // err = listMirroringTopicSelection(serviceAPI) + // if err != nil { + // fmt.Printf("%s\n", err.Error()) + // os.Exit(1) + // } + + fmt.Printf("Delete Topic\n") + err = deleteTopic(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } + + fmt.Printf("List Topics\n") + err = listTopics(serviceAPI) + if err != nil { + fmt.Printf("%s\n", err.Error()) + os.Exit(1) + } +} + +func listTopics(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the ListTopicsOptions model + listTopicsOptionsModel := new(adminrestv1.ListTopicsOptions) + + // Call ListTopics. + result, response, operationErr := serviceAPI.ListTopics(listTopicsOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Topics" + operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusOK { + return fmt.Errorf("Error Listing Topics: status %d\n", response.StatusCode) + } + + // Loop and print topics. + for _, topicDetail := range result { + fmt.Printf("\tname: %s\n", *topicDetail.Name) + } + return nil +} // func.end + +func topicDetails(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the GetTopicOptions model + getTopicOptionsModel := new(adminrestv1.GetTopicOptions) + getTopicOptionsModel.TopicName = core.StringPtr("test-topic") + + // Call List Topic Details. + result, response, operationErr := serviceAPI.GetTopic(getTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Topic Details" + operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusOK { + return fmt.Errorf("Error Listing Topic Details: status %d\n", response.StatusCode) + } + + // Print topics details. + fmt.Printf("\tname: \t\t\t%s\n", *result.Name) + + // The number of partitions. + fmt.Printf("\tno of partitions: \t%d\n", *result.Partitions) + + // The number of replication factor. + fmt.Printf("\treplication factor: \t%d\n", *result.ReplicationFactor) + + // // The value of config property 'retention.ms'. + fmt.Printf("\tretention (ms): \t%d\n", *result.RetentionMs) + + // // The value of config property 'cleanup.policy'. + fmt.Printf("\tcleanup policy: \t%s\n", *result.CleanupPolicy) + + // Configs *TopicConfigs + fmt.Printf("\ttopic configs: \t\t%+v\n", *result.Configs) + + // The replia assignment of the topic. + // ReplicaAssignments []ReplicaAssignment + for _, assignment := range result.ReplicaAssignments { + fmt.Printf("\tassignment: \t\tid:%d, \tbrokers: %+v\n", assignment.ID, assignment.Brokers) + } + + return nil + +} // func.end + +func createTopic(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the createTopicOptionsModel. + createTopicOptionsModel := new(adminrestv1.CreateTopicOptions) + createTopicOptionsModel.Name = core.StringPtr("test-topic") + createTopicOptionsModel.PartitionCount = core.Int64Ptr(int64(1)) + + // Create the Topic. + response, operationErr := serviceAPI.CreateTopic(createTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Creating Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Creating Topic: status %d\n", response.StatusCode) + } + + fmt.Printf("\tname: %s created\n", *createTopicOptionsModel.Name) + + return nil +} // func.end + +func deleteTopic(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the DeleteTopicOptions model + deleteTopicOptionsModel := new(adminrestv1.DeleteTopicOptions) + deleteTopicOptionsModel.TopicName = core.StringPtr("test-topic") + + // Delete Topic + response, operationErr := serviceAPI.DeleteTopic(deleteTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Deleting Topic: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Deleting Topic: status %d\n", response.StatusCode) + } + + fmt.Printf("\tname: %s deleted\n", *deleteTopicOptionsModel.TopicName) + return nil +} // func.end + +func updateTopicDetails(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the UpdateTopicOptions model + updateTopicOptionsModel := new(adminrestv1.UpdateTopicOptions) + updateTopicOptionsModel.TopicName = core.StringPtr("test-topic") + updateTopicOptionsModel.NewTotalPartitionCount = core.Int64Ptr(int64(6)) + + // Invoke operation with valid options model. + response, operationErr := serviceAPI.UpdateTopic(updateTopicOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Updating Topic: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Updating Topics: status %d\n", response.StatusCode) + } + + fmt.Printf("\tname: %s updated\n", *updateTopicOptionsModel.TopicName) + + return nil +} // func.end + +// nolint +func replaceMirroringTopicSelection(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the ReplaceMirroringTopicSelectionOptions model + replaceMirroringTopicSelectionOptionsModel := new(adminrestv1.ReplaceMirroringTopicSelectionOptions) + replaceMirroringTopicSelectionOptionsModel.Includes = []string{"test-topic"} + + // Invoke operation with valid options model. + result, response, operationErr := serviceAPI.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Replacing Mirroring Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Replacing Mirroring Topics: status %d\n", response.StatusCode) + } + + // Loop and print mirroring topics. + for _, topicName := range result.Includes { + fmt.Printf("\ttopic added: %s\n", topicName) + } + + return nil +} // func.end + +// nolint +func listMirroringTopicSelection(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the GetMirroringTopicSelectionOptions model + getMirroringTopicSelectionOptionsModel := new(adminrestv1.GetMirroringTopicSelectionOptions) + + // Call GetMirroringTopicSelection. + result, response, operationErr := serviceAPI.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Mirroring Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Listing Mirroring Topics: status %d\n", response.StatusCode) + } + + // Loop and print mirroring topics. + for _, topicName := range result.Includes { + fmt.Printf("\tname: %s\n", topicName) + } + + return nil +} // func.end + +// nolint +func getMirroringActiveTopics(serviceAPI *adminrestv1.AdminrestV1) error { + // Construct an instance of the GetMirroringActiveTopicsOptions model + getMirroringActiveTopicsOptionsModel := new(adminrestv1.GetMirroringActiveTopicsOptions) + + // Call GetMirroringActiveTopics. + result, response, operationErr := serviceAPI.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel) + if operationErr != nil { + return fmt.Errorf("Error Listing Active Mirroring Topics: %s\n", operationErr.Error()) + } + + // Check the result. + if response.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error Listing Active Mirroring Topics: status %d\n", response.StatusCode) + } + + // Loop and print mirroring topics. + for _, topicName := range result.ActiveTopics { + fmt.Printf("\tname: %s\n", topicName) + } + + return nil +} // func.end diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a34b7a7 --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module github.com/IBM/eventstreams-go-sdk + +go 1.13 + +require ( + github.com/IBM/go-sdk-core/v4 v4.10.0 + github.com/go-openapi/strfmt v0.20.0 + github.com/onsi/ginkgo v1.15.1 + github.com/onsi/gomega v1.11.0 + github.com/stretchr/testify v1.7.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b1bd62e --- /dev/null +++ b/go.sum @@ -0,0 +1,228 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/IBM/go-sdk-core/v4 v4.10.0 h1:aLoKusSFVsxMJeKHf8csj9tBWt4Y50kVvfxoKh6scN0= +github.com/IBM/go-sdk-core/v4 v4.10.0/go.mod h1:0uz2ca0MZ2DwsBRGl9Jp3EaCTqxmKZTdvV/CkCB7JnI= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/strfmt v0.19.10/go.mod h1:qBBipho+3EoIqn6YDI+4RnQEtj6jT/IdKm+PAlXxSUc= +github.com/go-openapi/strfmt v0.20.0 h1:l2omNtmNbMc39IGptl9BuXBEKcZfS8zjrTsPKTiJiDM= +github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= +github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= +github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= +github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= +github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= +github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= +github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= +github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= +github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= +github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= +github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= +github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= +github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM= +github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.15.1 h1:DsXNrKujDlkMS9Rsxmd+Fg7S6Kc5lhE+qX8tY6laOxc= +github.com/onsi/ginkgo v1.15.1/go.mod h1:Dd6YFfwBW84ETqqtL0CPyPXillHgY6XhQH3uuCCTr/o= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= +github.com/onsi/gomega v1.11.0 h1:+CqWgvj0OZycCaqclBD1pxKHAU+tOkHmQIWvDHq2aug= +github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= +github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.mongodb.org/mongo-driver v1.4.2/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.4.3 h1:moga+uhicpVshTyaqY9L23E6QqwcHRUv1sqyOsoyOO8= +go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= +gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/.openapi-generator-ignore b/pkg/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/pkg/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/pkg/.openapi-generator/VERSION b/pkg/.openapi-generator/VERSION new file mode 100644 index 0000000..717311e --- /dev/null +++ b/pkg/.openapi-generator/VERSION @@ -0,0 +1 @@ +unset \ No newline at end of file diff --git a/pkg/adminrestv1/adminrest_v1.go b/pkg/adminrestv1/adminrest_v1.go new file mode 100644 index 0000000..c0ce227 --- /dev/null +++ b/pkg/adminrestv1/adminrest_v1.go @@ -0,0 +1,1124 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.25.0-2b3f843a-20210115-164628 + */ + +// Package adminrestv1 : Operations and models for the AdminrestV1 service +package adminrestv1 + +import ( + "context" + "encoding/json" + "fmt" + "github.com/IBM/eventstreams-go-sdk/pkg/common" + "github.com/IBM/go-sdk-core/v4/core" + "net/http" + "reflect" + "time" +) + +// AdminrestV1 : The administration REST API for IBM Event Streams on Cloud. +// +// Version: 1.1.0 +type AdminrestV1 struct { + Service *core.BaseService +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://adminrest.cloud.ibm.com" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "adminrest" + +// AdminrestV1Options : Service options +type AdminrestV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator +} + +// NewAdminrestV1UsingExternalConfig : constructs an instance of AdminrestV1 with passed in options and external configuration. +func NewAdminrestV1UsingExternalConfig(options *AdminrestV1Options) (adminrest *AdminrestV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + adminrest, err = NewAdminrestV1(options) + if err != nil { + return + } + + err = adminrest.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = adminrest.Service.SetServiceURL(options.URL) + } + return +} + +// NewAdminrestV1 : constructs an instance of AdminrestV1 with passed in options. +func NewAdminrestV1(options *AdminrestV1Options) (service *AdminrestV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + service = &AdminrestV1{ + Service: baseService, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "adminrest" suitable for processing requests. +func (adminrest *AdminrestV1) Clone() *AdminrestV1 { + if core.IsNil(adminrest) { + return nil + } + clone := *adminrest + clone.Service = adminrest.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (adminrest *AdminrestV1) SetServiceURL(url string) error { + return adminrest.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (adminrest *AdminrestV1) GetServiceURL() string { + return adminrest.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (adminrest *AdminrestV1) SetDefaultHeaders(headers http.Header) { + adminrest.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (adminrest *AdminrestV1) SetEnableGzipCompression(enableGzip bool) { + adminrest.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (adminrest *AdminrestV1) GetEnableGzipCompression() bool { + return adminrest.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (adminrest *AdminrestV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + adminrest.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (adminrest *AdminrestV1) DisableRetries() { + adminrest.Service.DisableRetries() +} + +// CreateTopic : Create a new topic +// Create a new topic. +func (adminrest *AdminrestV1) CreateTopic(createTopicOptions *CreateTopicOptions) (response *core.DetailedResponse, err error) { + return adminrest.CreateTopicWithContext(context.Background(), createTopicOptions) +} + +// CreateTopicWithContext is an alternate form of the CreateTopic method which supports a Context parameter +func (adminrest *AdminrestV1) CreateTopicWithContext(ctx context.Context, createTopicOptions *CreateTopicOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createTopicOptions, "createTopicOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createTopicOptions, "createTopicOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/topics`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createTopicOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "CreateTopic") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createTopicOptions.Name != nil { + body["name"] = createTopicOptions.Name + } + if createTopicOptions.Partitions != nil { + body["partitions"] = createTopicOptions.Partitions + } + if createTopicOptions.PartitionCount != nil { + body["partition_count"] = createTopicOptions.PartitionCount + } + if createTopicOptions.Configs != nil { + body["configs"] = createTopicOptions.Configs + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = adminrest.Service.Request(request, nil) + + return +} + +// 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. +func (adminrest *AdminrestV1) ListTopics(listTopicsOptions *ListTopicsOptions) (result []TopicDetail, response *core.DetailedResponse, err error) { + return adminrest.ListTopicsWithContext(context.Background(), listTopicsOptions) +} + +// ListTopicsWithContext is an alternate form of the ListTopics method which supports a Context parameter +func (adminrest *AdminrestV1) ListTopicsWithContext(ctx context.Context, listTopicsOptions *ListTopicsOptions) (result []TopicDetail, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listTopicsOptions, "listTopicsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/topics`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listTopicsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "ListTopics") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listTopicsOptions.TopicFilter != nil { + builder.AddQuery("topic_filter", fmt.Sprint(*listTopicsOptions.TopicFilter)) + } + if listTopicsOptions.PerPage != nil { + builder.AddQuery("per_page", fmt.Sprint(*listTopicsOptions.PerPage)) + } + if listTopicsOptions.Page != nil { + builder.AddQuery("page", fmt.Sprint(*listTopicsOptions.Page)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse []json.RawMessage + response, err = adminrest.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTopicDetail) + if err != nil { + return + } + response.Result = result + + return +} + +// GetTopic : Get detailed information on a topic +// Get detailed information on a topic. +func (adminrest *AdminrestV1) GetTopic(getTopicOptions *GetTopicOptions) (result *TopicDetail, response *core.DetailedResponse, err error) { + return adminrest.GetTopicWithContext(context.Background(), getTopicOptions) +} + +// GetTopicWithContext is an alternate form of the GetTopic method which supports a Context parameter +func (adminrest *AdminrestV1) GetTopicWithContext(ctx context.Context, getTopicOptions *GetTopicOptions) (result *TopicDetail, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getTopicOptions, "getTopicOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getTopicOptions, "getTopicOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "topic_name": *getTopicOptions.TopicName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/topics/{topic_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getTopicOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "GetTopic") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = adminrest.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTopicDetail) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteTopic : Delete a topic +// Delete a topic. +func (adminrest *AdminrestV1) DeleteTopic(deleteTopicOptions *DeleteTopicOptions) (response *core.DetailedResponse, err error) { + return adminrest.DeleteTopicWithContext(context.Background(), deleteTopicOptions) +} + +// DeleteTopicWithContext is an alternate form of the DeleteTopic method which supports a Context parameter +func (adminrest *AdminrestV1) DeleteTopicWithContext(ctx context.Context, deleteTopicOptions *DeleteTopicOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteTopicOptions, "deleteTopicOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteTopicOptions, "deleteTopicOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "topic_name": *deleteTopicOptions.TopicName, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/topics/{topic_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteTopicOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "DeleteTopic") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + response, err = adminrest.Service.Request(request, nil) + + return +} + +// 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. +func (adminrest *AdminrestV1) UpdateTopic(updateTopicOptions *UpdateTopicOptions) (response *core.DetailedResponse, err error) { + return adminrest.UpdateTopicWithContext(context.Background(), updateTopicOptions) +} + +// UpdateTopicWithContext is an alternate form of the UpdateTopic method which supports a Context parameter +func (adminrest *AdminrestV1) UpdateTopicWithContext(ctx context.Context, updateTopicOptions *UpdateTopicOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateTopicOptions, "updateTopicOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateTopicOptions, "updateTopicOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "topic_name": *updateTopicOptions.TopicName, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/topics/{topic_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateTopicOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "UpdateTopic") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateTopicOptions.NewTotalPartitionCount != nil { + body["new_total_partition_count"] = updateTopicOptions.NewTotalPartitionCount + } + if updateTopicOptions.Configs != nil { + body["configs"] = updateTopicOptions.Configs + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = adminrest.Service.Request(request, nil) + + return +} + +// GetMirroringTopicSelection : Get current topic selection for mirroring +// Get current topic selection for mirroring. +func (adminrest *AdminrestV1) GetMirroringTopicSelection(getMirroringTopicSelectionOptions *GetMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error) { + return adminrest.GetMirroringTopicSelectionWithContext(context.Background(), getMirroringTopicSelectionOptions) +} + +// GetMirroringTopicSelectionWithContext is an alternate form of the GetMirroringTopicSelection method which supports a Context parameter +func (adminrest *AdminrestV1) GetMirroringTopicSelectionWithContext(ctx context.Context, getMirroringTopicSelectionOptions *GetMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(getMirroringTopicSelectionOptions, "getMirroringTopicSelectionOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/mirroring/topic-selection`, nil) + if err != nil { + return + } + + for headerName, headerValue := range getMirroringTopicSelectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "GetMirroringTopicSelection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = adminrest.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMirroringTopicSelection) + if err != nil { + return + } + response.Result = result + + return +} + +// ReplaceMirroringTopicSelection : Replace topic selection for mirroring +// Replace topic selection for mirroring. This operation replaces the complete set of mirroring topic selections. +func (adminrest *AdminrestV1) ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptions *ReplaceMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error) { + return adminrest.ReplaceMirroringTopicSelectionWithContext(context.Background(), replaceMirroringTopicSelectionOptions) +} + +// ReplaceMirroringTopicSelectionWithContext is an alternate form of the ReplaceMirroringTopicSelection method which supports a Context parameter +func (adminrest *AdminrestV1) ReplaceMirroringTopicSelectionWithContext(ctx context.Context, replaceMirroringTopicSelectionOptions *ReplaceMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceMirroringTopicSelectionOptions, "replaceMirroringTopicSelectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceMirroringTopicSelectionOptions, "replaceMirroringTopicSelectionOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/mirroring/topic-selection`, nil) + if err != nil { + return + } + + for headerName, headerValue := range replaceMirroringTopicSelectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "ReplaceMirroringTopicSelection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if replaceMirroringTopicSelectionOptions.Includes != nil { + body["includes"] = replaceMirroringTopicSelectionOptions.Includes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = adminrest.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMirroringTopicSelection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetMirroringActiveTopics : Get topics that are being actively mirrored +// Get topics that are being actively mirrored. +func (adminrest *AdminrestV1) GetMirroringActiveTopics(getMirroringActiveTopicsOptions *GetMirroringActiveTopicsOptions) (result *MirroringActiveTopics, response *core.DetailedResponse, err error) { + return adminrest.GetMirroringActiveTopicsWithContext(context.Background(), getMirroringActiveTopicsOptions) +} + +// GetMirroringActiveTopicsWithContext is an alternate form of the GetMirroringActiveTopics method which supports a Context parameter +func (adminrest *AdminrestV1) GetMirroringActiveTopicsWithContext(ctx context.Context, getMirroringActiveTopicsOptions *GetMirroringActiveTopicsOptions) (result *MirroringActiveTopics, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(getMirroringActiveTopicsOptions, "getMirroringActiveTopicsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = adminrest.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(adminrest.Service.Options.URL, `/admin/mirroring/active-topics`, nil) + if err != nil { + return + } + + for headerName, headerValue := range getMirroringActiveTopicsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("adminrest", "V1", "GetMirroringActiveTopics") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = adminrest.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMirroringActiveTopics) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateTopicOptions : The CreateTopic options. +type CreateTopicOptions struct { + // The name of topic to be created. + Name *string + + // The number of partitions. + Partitions *int64 + + // The number of partitions, this field takes precedence over 'partitions'. Default value is 1 if not specified. + PartitionCount *int64 + + // The config properties to be set for the new topic. + Configs []ConfigCreate + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateTopicOptions : Instantiate CreateTopicOptions +func (*AdminrestV1) NewCreateTopicOptions() *CreateTopicOptions { + return &CreateTopicOptions{} +} + +// SetName : Allow user to set Name +func (options *CreateTopicOptions) SetName(name string) *CreateTopicOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetPartitions : Allow user to set Partitions +func (options *CreateTopicOptions) SetPartitions(partitions int64) *CreateTopicOptions { + options.Partitions = core.Int64Ptr(partitions) + return options +} + +// SetPartitionCount : Allow user to set PartitionCount +func (options *CreateTopicOptions) SetPartitionCount(partitionCount int64) *CreateTopicOptions { + options.PartitionCount = core.Int64Ptr(partitionCount) + return options +} + +// SetConfigs : Allow user to set Configs +func (options *CreateTopicOptions) SetConfigs(configs []ConfigCreate) *CreateTopicOptions { + options.Configs = configs + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateTopicOptions) SetHeaders(param map[string]string) *CreateTopicOptions { + options.Headers = param + return options +} + +// DeleteTopicOptions : The DeleteTopic options. +type DeleteTopicOptions struct { + // The topic name for the topic to be listed. + TopicName *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteTopicOptions : Instantiate DeleteTopicOptions +func (*AdminrestV1) NewDeleteTopicOptions(topicName string) *DeleteTopicOptions { + return &DeleteTopicOptions{ + TopicName: core.StringPtr(topicName), + } +} + +// SetTopicName : Allow user to set TopicName +func (options *DeleteTopicOptions) SetTopicName(topicName string) *DeleteTopicOptions { + options.TopicName = core.StringPtr(topicName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteTopicOptions) SetHeaders(param map[string]string) *DeleteTopicOptions { + options.Headers = param + return options +} + +// GetMirroringActiveTopicsOptions : The GetMirroringActiveTopics options. +type GetMirroringActiveTopicsOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetMirroringActiveTopicsOptions : Instantiate GetMirroringActiveTopicsOptions +func (*AdminrestV1) NewGetMirroringActiveTopicsOptions() *GetMirroringActiveTopicsOptions { + return &GetMirroringActiveTopicsOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *GetMirroringActiveTopicsOptions) SetHeaders(param map[string]string) *GetMirroringActiveTopicsOptions { + options.Headers = param + return options +} + +// GetMirroringTopicSelectionOptions : The GetMirroringTopicSelection options. +type GetMirroringTopicSelectionOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetMirroringTopicSelectionOptions : Instantiate GetMirroringTopicSelectionOptions +func (*AdminrestV1) NewGetMirroringTopicSelectionOptions() *GetMirroringTopicSelectionOptions { + return &GetMirroringTopicSelectionOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *GetMirroringTopicSelectionOptions) SetHeaders(param map[string]string) *GetMirroringTopicSelectionOptions { + options.Headers = param + return options +} + +// GetTopicOptions : The GetTopic options. +type GetTopicOptions struct { + // The topic name for the topic to be listed. + TopicName *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetTopicOptions : Instantiate GetTopicOptions +func (*AdminrestV1) NewGetTopicOptions(topicName string) *GetTopicOptions { + return &GetTopicOptions{ + TopicName: core.StringPtr(topicName), + } +} + +// SetTopicName : Allow user to set TopicName +func (options *GetTopicOptions) SetTopicName(topicName string) *GetTopicOptions { + options.TopicName = core.StringPtr(topicName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetTopicOptions) SetHeaders(param map[string]string) *GetTopicOptions { + options.Headers = param + return options +} + +// ListTopicsOptions : The ListTopics options. +type ListTopicsOptions struct { + // 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.* /`. + TopicFilter *string + + // The number of topic names to be returns. + PerPage *int64 + + // The page number to be returned. The number 1 represents the first page. The default value is 1. + Page *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListTopicsOptions : Instantiate ListTopicsOptions +func (*AdminrestV1) NewListTopicsOptions() *ListTopicsOptions { + return &ListTopicsOptions{} +} + +// SetTopicFilter : Allow user to set TopicFilter +func (options *ListTopicsOptions) SetTopicFilter(topicFilter string) *ListTopicsOptions { + options.TopicFilter = core.StringPtr(topicFilter) + return options +} + +// SetPerPage : Allow user to set PerPage +func (options *ListTopicsOptions) SetPerPage(perPage int64) *ListTopicsOptions { + options.PerPage = core.Int64Ptr(perPage) + return options +} + +// SetPage : Allow user to set Page +func (options *ListTopicsOptions) SetPage(page int64) *ListTopicsOptions { + options.Page = core.Int64Ptr(page) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListTopicsOptions) SetHeaders(param map[string]string) *ListTopicsOptions { + options.Headers = param + return options +} + +// ReplaceMirroringTopicSelectionOptions : The ReplaceMirroringTopicSelection options. +type ReplaceMirroringTopicSelectionOptions struct { + Includes []string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceMirroringTopicSelectionOptions : Instantiate ReplaceMirroringTopicSelectionOptions +func (*AdminrestV1) NewReplaceMirroringTopicSelectionOptions() *ReplaceMirroringTopicSelectionOptions { + return &ReplaceMirroringTopicSelectionOptions{} +} + +// SetIncludes : Allow user to set Includes +func (options *ReplaceMirroringTopicSelectionOptions) SetIncludes(includes []string) *ReplaceMirroringTopicSelectionOptions { + options.Includes = includes + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceMirroringTopicSelectionOptions) SetHeaders(param map[string]string) *ReplaceMirroringTopicSelectionOptions { + options.Headers = param + return options +} + +// ReplicaAssignmentBrokers : ReplicaAssignmentBrokers struct +type ReplicaAssignmentBrokers struct { + Replicas []int64 `json:"replicas,omitempty"` +} + +// UnmarshalReplicaAssignmentBrokers unmarshals an instance of ReplicaAssignmentBrokers from the specified map of raw messages. +func UnmarshalReplicaAssignmentBrokers(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReplicaAssignmentBrokers) + err = core.UnmarshalPrimitive(m, "replicas", &obj.Replicas) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UpdateTopicOptions : The UpdateTopic options. +type UpdateTopicOptions struct { + // The topic name for the topic to be listed. + TopicName *string `validate:"required,ne="` + + // The new partition number to be increased. + NewTotalPartitionCount *int64 + + // 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 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateTopicOptions : Instantiate UpdateTopicOptions +func (*AdminrestV1) NewUpdateTopicOptions(topicName string) *UpdateTopicOptions { + return &UpdateTopicOptions{ + TopicName: core.StringPtr(topicName), + } +} + +// SetTopicName : Allow user to set TopicName +func (options *UpdateTopicOptions) SetTopicName(topicName string) *UpdateTopicOptions { + options.TopicName = core.StringPtr(topicName) + return options +} + +// SetNewTotalPartitionCount : Allow user to set NewTotalPartitionCount +func (options *UpdateTopicOptions) SetNewTotalPartitionCount(newTotalPartitionCount int64) *UpdateTopicOptions { + options.NewTotalPartitionCount = core.Int64Ptr(newTotalPartitionCount) + return options +} + +// SetConfigs : Allow user to set Configs +func (options *UpdateTopicOptions) SetConfigs(configs []ConfigUpdate) *UpdateTopicOptions { + options.Configs = configs + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateTopicOptions) SetHeaders(param map[string]string) *UpdateTopicOptions { + options.Headers = param + return options +} + +// ConfigCreate : ConfigCreate struct +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"` +} + +// UnmarshalConfigCreate unmarshals an instance of ConfigCreate from the specified map of raw messages. +func UnmarshalConfigCreate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigCreate) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ConfigUpdate : ConfigUpdate struct +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"` +} + +// UnmarshalConfigUpdate unmarshals an instance of ConfigUpdate from the specified map of raw messages. +func UnmarshalConfigUpdate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigUpdate) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "reset_to_default", &obj.ResetToDefault) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MirroringActiveTopics : Topics that are being actively mirrored. +type MirroringActiveTopics struct { + ActiveTopics []string `json:"active_topics,omitempty"` +} + +// UnmarshalMirroringActiveTopics unmarshals an instance of MirroringActiveTopics from the specified map of raw messages. +func UnmarshalMirroringActiveTopics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MirroringActiveTopics) + err = core.UnmarshalPrimitive(m, "active_topics", &obj.ActiveTopics) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MirroringTopicSelection : Mirroring topic selection payload. +type MirroringTopicSelection struct { + Includes []string `json:"includes,omitempty"` +} + +// UnmarshalMirroringTopicSelection unmarshals an instance of MirroringTopicSelection from the specified map of raw messages. +func UnmarshalMirroringTopicSelection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MirroringTopicSelection) + err = core.UnmarshalPrimitive(m, "includes", &obj.Includes) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReplicaAssignment : ReplicaAssignment struct +type ReplicaAssignment struct { + // The ID of the partition. + ID *int64 `json:"id,omitempty"` + + Brokers *ReplicaAssignmentBrokers `json:"brokers,omitempty"` +} + +// UnmarshalReplicaAssignment unmarshals an instance of ReplicaAssignment from the specified map of raw messages. +func UnmarshalReplicaAssignment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReplicaAssignment) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "brokers", &obj.Brokers, UnmarshalReplicaAssignmentBrokers) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TopicConfigs : TopicConfigs struct +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"` +} + +// UnmarshalTopicConfigs unmarshals an instance of TopicConfigs from the specified map of raw messages. +func UnmarshalTopicConfigs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TopicConfigs) + err = core.UnmarshalPrimitive(m, "cleanup.policy", &obj.CleanupPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min.insync.replicas", &obj.MinInsyncReplicas) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "retention.bytes", &obj.RetentionBytes) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "retention.ms", &obj.RetentionMs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "segment.bytes", &obj.SegmentBytes) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "segment.index.bytes", &obj.SegmentIndexBytes) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "segment.ms", &obj.SegmentMs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TopicDetail : TopicDetail struct +type TopicDetail struct { + // The name of the topic. + Name *string `json:"name,omitempty"` + + // The number of partitions. + Partitions *int64 `json:"partitions,omitempty"` + + // The number of replication factor. + ReplicationFactor *int64 `json:"replicationFactor,omitempty"` + + // The value of config property 'retention.ms'. + RetentionMs *int64 `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"` +} + +// UnmarshalTopicDetail unmarshals an instance of TopicDetail from the specified map of raw messages. +func UnmarshalTopicDetail(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TopicDetail) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "partitions", &obj.Partitions) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replicationFactor", &obj.ReplicationFactor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "retentionMs", &obj.RetentionMs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cleanupPolicy", &obj.CleanupPolicy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "configs", &obj.Configs, UnmarshalTopicConfigs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replicaAssignments", &obj.ReplicaAssignments, UnmarshalReplicaAssignment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} diff --git a/pkg/adminrestv1/adminrest_v1_suite_test.go b/pkg/adminrestv1/adminrest_v1_suite_test.go new file mode 100644 index 0000000..6384b69 --- /dev/null +++ b/pkg/adminrestv1/adminrest_v1_suite_test.go @@ -0,0 +1,28 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package adminrestv1 + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "testing" +) + +func TestAdminrestV1(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "AdminrestV1 Suite") +} diff --git a/pkg/adminrestv1/adminrest_v1_test.go b/pkg/adminrestv1/adminrest_v1_test.go new file mode 100644 index 0000000..bdd44fb --- /dev/null +++ b/pkg/adminrestv1/adminrest_v1_test.go @@ -0,0 +1,1519 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package adminrestv1 + +import ( + "bytes" + "context" + "fmt" + + "github.com/IBM/go-sdk-core/v4/core" + "github.com/go-openapi/strfmt" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "os" + "time" +) + +var _ = Describe(`AdminrestV1`, func() { + var testServer *httptest.Server + Describe(`Service constructor tests`, func() { + It(`Instantiate service client`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(adminrestService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + }) + It(`Instantiate service client with error: Invalid URL`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: "{BAD_URL_STRING", + }) + Expect(adminrestService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Invalid Auth`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: "https://adminrestv1/api", + Authenticator: &core.BasicAuthenticator{ + Username: "", + Password: "", + }, + }) + Expect(adminrestService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + }) + }) + Describe(`Service constructor tests using external config`, func() { + Context(`Using external config, construct service client instances`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "ADMINREST_URL": "https://adminrestv1/api", + "ADMINREST_AUTH_TYPE": "noauth", + } + + It(`Create service client using external config successfully`, func() { + SetTestEnvironment(testEnvironment) + adminrestService, serviceErr := NewAdminrestV1UsingExternalConfig(&AdminrestV1Options{}) + Expect(adminrestService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + ClearTestEnvironment(testEnvironment) + + clone := adminrestService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != adminrestService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(adminrestService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(adminrestService.Service.Options.Authenticator)) + }) + It(`Create service client using external config and set url from constructor successfully`, func() { + SetTestEnvironment(testEnvironment) + adminrestService, serviceErr := NewAdminrestV1UsingExternalConfig(&AdminrestV1Options{ + URL: "https://testService/api", + }) + Expect(adminrestService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + + clone := adminrestService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != adminrestService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(adminrestService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(adminrestService.Service.Options.Authenticator)) + }) + It(`Create service client using external config and set url programatically successfully`, func() { + SetTestEnvironment(testEnvironment) + adminrestService, serviceErr := NewAdminrestV1UsingExternalConfig(&AdminrestV1Options{}) + err := adminrestService.SetServiceURL("https://testService/api") + Expect(err).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + + clone := adminrestService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != adminrestService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(adminrestService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(adminrestService.Service.Options.Authenticator)) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "ADMINREST_URL": "https://adminrestv1/api", + "ADMINREST_AUTH_TYPE": "someOtherAuth", + } + + SetTestEnvironment(testEnvironment) + adminrestService, serviceErr := NewAdminrestV1UsingExternalConfig(&AdminrestV1Options{}) + + It(`Instantiate service client with error`, func() { + Expect(adminrestService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid URL`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "ADMINREST_AUTH_TYPE": "NOAuth", + } + + SetTestEnvironment(testEnvironment) + adminrestService, serviceErr := NewAdminrestV1UsingExternalConfig(&AdminrestV1Options{ + URL: "{BAD_URL_STRING", + }) + + It(`Instantiate service client with error`, func() { + Expect(adminrestService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + }) + Describe(`Regional endpoint tests`, func() { + It(`GetServiceURLForRegion(region string)`, func() { + var url string + var err error + url, err = GetServiceURLForRegion("INVALID_REGION") + Expect(url).To(BeEmpty()) + Expect(err).ToNot(BeNil()) + fmt.Fprintf(GinkgoWriter, "Expected error: %s\n", err.Error()) + }) + }) + + Describe(`CreateTopic(createTopicOptions *CreateTopicOptions)`, func() { + createTopicPath := "/admin/topics" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createTopicPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + res.WriteHeader(202) + })) + }) + It(`Invoke CreateTopic successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := adminrestService.CreateTopic(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the ConfigCreate model + configCreateModel := new(ConfigCreate) + configCreateModel.Name = core.StringPtr("testString") + configCreateModel.Value = core.StringPtr("testString") + + // Construct an instance of the CreateTopicOptions model + createTopicOptionsModel := new(CreateTopicOptions) + createTopicOptionsModel.Name = core.StringPtr("testString") + createTopicOptionsModel.Partitions = core.Int64Ptr(int64(26)) + createTopicOptionsModel.PartitionCount = core.Int64Ptr(int64(1)) + createTopicOptionsModel.Configs = []ConfigCreate{*configCreateModel} + createTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = adminrestService.CreateTopic(createTopicOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke CreateTopic with error: Operation request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the ConfigCreate model + configCreateModel := new(ConfigCreate) + configCreateModel.Name = core.StringPtr("testString") + configCreateModel.Value = core.StringPtr("testString") + + // Construct an instance of the CreateTopicOptions model + createTopicOptionsModel := new(CreateTopicOptions) + createTopicOptionsModel.Name = core.StringPtr("testString") + createTopicOptionsModel.Partitions = core.Int64Ptr(int64(26)) + createTopicOptionsModel.PartitionCount = core.Int64Ptr(int64(1)) + createTopicOptionsModel.Configs = []ConfigCreate{*configCreateModel} + createTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := adminrestService.CreateTopic(createTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListTopics(listTopicsOptions *ListTopicsOptions) - Operation response error`, func() { + listTopicsPath := "/admin/topics" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listTopicsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["topic_filter"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["per_page"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + Expect(req.URL.Query()["page"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListTopics with error: Operation response processing error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the ListTopicsOptions model + listTopicsOptionsModel := new(ListTopicsOptions) + listTopicsOptionsModel.TopicFilter = core.StringPtr("testString") + listTopicsOptionsModel.PerPage = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Page = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := adminrestService.ListTopics(listTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + adminrestService.EnableRetries(0, 0) + result, response, operationErr = adminrestService.ListTopics(listTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`ListTopics(listTopicsOptions *ListTopicsOptions)`, func() { + listTopicsPath := "/admin/topics" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listTopicsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["topic_filter"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["per_page"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + Expect(req.URL.Query()["page"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `[{"name": "Name", "partitions": 10, "replicationFactor": 17, "retentionMs": 11, "cleanupPolicy": "CleanupPolicy", "configs": {"cleanup.policy": "CleanupPolicy", "min.insync.replicas": "MinInsyncReplicas", "retention.bytes": "RetentionBytes", "retention.ms": "RetentionMs", "segment.bytes": "SegmentBytes", "segment.index.bytes": "SegmentIndexBytes", "segment.ms": "SegmentMs"}, "replicaAssignments": [{"id": 2, "brokers": {"replicas": [8]}}]}]`) + })) + }) + It(`Invoke ListTopics successfully with retries`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + adminrestService.EnableRetries(0, 0) + + // Construct an instance of the ListTopicsOptions model + listTopicsOptionsModel := new(ListTopicsOptions) + listTopicsOptionsModel.TopicFilter = core.StringPtr("testString") + listTopicsOptionsModel.PerPage = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Page = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := adminrestService.ListTopicsWithContext(ctx, listTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + adminrestService.DisableRetries() + result, response, operationErr := adminrestService.ListTopics(listTopicsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = adminrestService.ListTopicsWithContext(ctx, listTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listTopicsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["topic_filter"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["per_page"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + Expect(req.URL.Query()["page"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `[{"name": "Name", "partitions": 10, "replicationFactor": 17, "retentionMs": 11, "cleanupPolicy": "CleanupPolicy", "configs": {"cleanup.policy": "CleanupPolicy", "min.insync.replicas": "MinInsyncReplicas", "retention.bytes": "RetentionBytes", "retention.ms": "RetentionMs", "segment.bytes": "SegmentBytes", "segment.index.bytes": "SegmentIndexBytes", "segment.ms": "SegmentMs"}, "replicaAssignments": [{"id": 2, "brokers": {"replicas": [8]}}]}]`) + })) + }) + It(`Invoke ListTopics successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := adminrestService.ListTopics(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListTopicsOptions model + listTopicsOptionsModel := new(ListTopicsOptions) + listTopicsOptionsModel.TopicFilter = core.StringPtr("testString") + listTopicsOptionsModel.PerPage = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Page = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = adminrestService.ListTopics(listTopicsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListTopics with error: Operation request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the ListTopicsOptions model + listTopicsOptionsModel := new(ListTopicsOptions) + listTopicsOptionsModel.TopicFilter = core.StringPtr("testString") + listTopicsOptionsModel.PerPage = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Page = core.Int64Ptr(int64(38)) + listTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := adminrestService.ListTopics(listTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetTopic(getTopicOptions *GetTopicOptions) - Operation response error`, func() { + getTopicPath := "/admin/topics/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getTopicPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetTopic with error: Operation response processing error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the GetTopicOptions model + getTopicOptionsModel := new(GetTopicOptions) + getTopicOptionsModel.TopicName = core.StringPtr("testString") + getTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := adminrestService.GetTopic(getTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + adminrestService.EnableRetries(0, 0) + result, response, operationErr = adminrestService.GetTopic(getTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetTopic(getTopicOptions *GetTopicOptions)`, func() { + getTopicPath := "/admin/topics/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getTopicPath)) + Expect(req.Method).To(Equal("GET")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"name": "Name", "partitions": 10, "replicationFactor": 17, "retentionMs": 11, "cleanupPolicy": "CleanupPolicy", "configs": {"cleanup.policy": "CleanupPolicy", "min.insync.replicas": "MinInsyncReplicas", "retention.bytes": "RetentionBytes", "retention.ms": "RetentionMs", "segment.bytes": "SegmentBytes", "segment.index.bytes": "SegmentIndexBytes", "segment.ms": "SegmentMs"}, "replicaAssignments": [{"id": 2, "brokers": {"replicas": [8]}}]}`) + })) + }) + It(`Invoke GetTopic successfully with retries`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + adminrestService.EnableRetries(0, 0) + + // Construct an instance of the GetTopicOptions model + getTopicOptionsModel := new(GetTopicOptions) + getTopicOptionsModel.TopicName = core.StringPtr("testString") + getTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := adminrestService.GetTopicWithContext(ctx, getTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + adminrestService.DisableRetries() + result, response, operationErr := adminrestService.GetTopic(getTopicOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = adminrestService.GetTopicWithContext(ctx, getTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getTopicPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"name": "Name", "partitions": 10, "replicationFactor": 17, "retentionMs": 11, "cleanupPolicy": "CleanupPolicy", "configs": {"cleanup.policy": "CleanupPolicy", "min.insync.replicas": "MinInsyncReplicas", "retention.bytes": "RetentionBytes", "retention.ms": "RetentionMs", "segment.bytes": "SegmentBytes", "segment.index.bytes": "SegmentIndexBytes", "segment.ms": "SegmentMs"}, "replicaAssignments": [{"id": 2, "brokers": {"replicas": [8]}}]}`) + })) + }) + It(`Invoke GetTopic successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := adminrestService.GetTopic(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetTopicOptions model + getTopicOptionsModel := new(GetTopicOptions) + getTopicOptionsModel.TopicName = core.StringPtr("testString") + getTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = adminrestService.GetTopic(getTopicOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetTopic with error: Operation validation and request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the GetTopicOptions model + getTopicOptionsModel := new(GetTopicOptions) + getTopicOptionsModel.TopicName = core.StringPtr("testString") + getTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := adminrestService.GetTopic(getTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetTopicOptions model with no property values + getTopicOptionsModelNew := new(GetTopicOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = adminrestService.GetTopic(getTopicOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`DeleteTopic(deleteTopicOptions *DeleteTopicOptions)`, func() { + deleteTopicPath := "/admin/topics/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteTopicPath)) + Expect(req.Method).To(Equal("DELETE")) + + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteTopic successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := adminrestService.DeleteTopic(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteTopicOptions model + deleteTopicOptionsModel := new(DeleteTopicOptions) + deleteTopicOptionsModel.TopicName = core.StringPtr("testString") + deleteTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = adminrestService.DeleteTopic(deleteTopicOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteTopic with error: Operation validation and request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the DeleteTopicOptions model + deleteTopicOptionsModel := new(DeleteTopicOptions) + deleteTopicOptionsModel.TopicName = core.StringPtr("testString") + deleteTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := adminrestService.DeleteTopic(deleteTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteTopicOptions model with no property values + deleteTopicOptionsModelNew := new(DeleteTopicOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = adminrestService.DeleteTopic(deleteTopicOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`UpdateTopic(updateTopicOptions *UpdateTopicOptions)`, func() { + updateTopicPath := "/admin/topics/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateTopicPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + res.WriteHeader(202) + })) + }) + It(`Invoke UpdateTopic successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := adminrestService.UpdateTopic(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the ConfigUpdate model + configUpdateModel := new(ConfigUpdate) + configUpdateModel.Name = core.StringPtr("testString") + configUpdateModel.Value = core.StringPtr("testString") + configUpdateModel.ResetToDefault = core.BoolPtr(true) + + // Construct an instance of the UpdateTopicOptions model + updateTopicOptionsModel := new(UpdateTopicOptions) + updateTopicOptionsModel.TopicName = core.StringPtr("testString") + updateTopicOptionsModel.NewTotalPartitionCount = core.Int64Ptr(int64(38)) + updateTopicOptionsModel.Configs = []ConfigUpdate{*configUpdateModel} + updateTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = adminrestService.UpdateTopic(updateTopicOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UpdateTopic with error: Operation validation and request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the ConfigUpdate model + configUpdateModel := new(ConfigUpdate) + configUpdateModel.Name = core.StringPtr("testString") + configUpdateModel.Value = core.StringPtr("testString") + configUpdateModel.ResetToDefault = core.BoolPtr(true) + + // Construct an instance of the UpdateTopicOptions model + updateTopicOptionsModel := new(UpdateTopicOptions) + updateTopicOptionsModel.TopicName = core.StringPtr("testString") + updateTopicOptionsModel.NewTotalPartitionCount = core.Int64Ptr(int64(38)) + updateTopicOptionsModel.Configs = []ConfigUpdate{*configUpdateModel} + updateTopicOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := adminrestService.UpdateTopic(updateTopicOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UpdateTopicOptions model with no property values + updateTopicOptionsModelNew := new(UpdateTopicOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = adminrestService.UpdateTopic(updateTopicOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetMirroringTopicSelection(getMirroringTopicSelectionOptions *GetMirroringTopicSelectionOptions) - Operation response error`, func() { + getMirroringTopicSelectionPath := "/admin/mirroring/topic-selection" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getMirroringTopicSelectionPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetMirroringTopicSelection with error: Operation response processing error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the GetMirroringTopicSelectionOptions model + getMirroringTopicSelectionOptionsModel := new(GetMirroringTopicSelectionOptions) + getMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := adminrestService.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + adminrestService.EnableRetries(0, 0) + result, response, operationErr = adminrestService.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetMirroringTopicSelection(getMirroringTopicSelectionOptions *GetMirroringTopicSelectionOptions)`, func() { + getMirroringTopicSelectionPath := "/admin/mirroring/topic-selection" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getMirroringTopicSelectionPath)) + Expect(req.Method).To(Equal("GET")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"includes": ["Includes"]}`) + })) + }) + It(`Invoke GetMirroringTopicSelection successfully with retries`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + adminrestService.EnableRetries(0, 0) + + // Construct an instance of the GetMirroringTopicSelectionOptions model + getMirroringTopicSelectionOptionsModel := new(GetMirroringTopicSelectionOptions) + getMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := adminrestService.GetMirroringTopicSelectionWithContext(ctx, getMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + adminrestService.DisableRetries() + result, response, operationErr := adminrestService.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = adminrestService.GetMirroringTopicSelectionWithContext(ctx, getMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getMirroringTopicSelectionPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"includes": ["Includes"]}`) + })) + }) + It(`Invoke GetMirroringTopicSelection successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := adminrestService.GetMirroringTopicSelection(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetMirroringTopicSelectionOptions model + getMirroringTopicSelectionOptionsModel := new(GetMirroringTopicSelectionOptions) + getMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = adminrestService.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetMirroringTopicSelection with error: Operation request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the GetMirroringTopicSelectionOptions model + getMirroringTopicSelectionOptionsModel := new(GetMirroringTopicSelectionOptions) + getMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := adminrestService.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptions *ReplaceMirroringTopicSelectionOptions) - Operation response error`, func() { + replaceMirroringTopicSelectionPath := "/admin/mirroring/topic-selection" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceMirroringTopicSelectionPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke ReplaceMirroringTopicSelection with error: Operation response processing error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the ReplaceMirroringTopicSelectionOptions model + replaceMirroringTopicSelectionOptionsModel := new(ReplaceMirroringTopicSelectionOptions) + replaceMirroringTopicSelectionOptionsModel.Includes = []string{"testString"} + replaceMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := adminrestService.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + adminrestService.EnableRetries(0, 0) + result, response, operationErr = adminrestService.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptions *ReplaceMirroringTopicSelectionOptions)`, func() { + replaceMirroringTopicSelectionPath := "/admin/mirroring/topic-selection" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceMirroringTopicSelectionPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"includes": ["Includes"]}`) + })) + }) + It(`Invoke ReplaceMirroringTopicSelection successfully with retries`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + adminrestService.EnableRetries(0, 0) + + // Construct an instance of the ReplaceMirroringTopicSelectionOptions model + replaceMirroringTopicSelectionOptionsModel := new(ReplaceMirroringTopicSelectionOptions) + replaceMirroringTopicSelectionOptionsModel.Includes = []string{"testString"} + replaceMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := adminrestService.ReplaceMirroringTopicSelectionWithContext(ctx, replaceMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + adminrestService.DisableRetries() + result, response, operationErr := adminrestService.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = adminrestService.ReplaceMirroringTopicSelectionWithContext(ctx, replaceMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceMirroringTopicSelectionPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"includes": ["Includes"]}`) + })) + }) + It(`Invoke ReplaceMirroringTopicSelection successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := adminrestService.ReplaceMirroringTopicSelection(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ReplaceMirroringTopicSelectionOptions model + replaceMirroringTopicSelectionOptionsModel := new(ReplaceMirroringTopicSelectionOptions) + replaceMirroringTopicSelectionOptionsModel.Includes = []string{"testString"} + replaceMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = adminrestService.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReplaceMirroringTopicSelection with error: Operation request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the ReplaceMirroringTopicSelectionOptions model + replaceMirroringTopicSelectionOptionsModel := new(ReplaceMirroringTopicSelectionOptions) + replaceMirroringTopicSelectionOptionsModel.Includes = []string{"testString"} + replaceMirroringTopicSelectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := adminrestService.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetMirroringActiveTopics(getMirroringActiveTopicsOptions *GetMirroringActiveTopicsOptions) - Operation response error`, func() { + getMirroringActiveTopicsPath := "/admin/mirroring/active-topics" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getMirroringActiveTopicsPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetMirroringActiveTopics with error: Operation response processing error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the GetMirroringActiveTopicsOptions model + getMirroringActiveTopicsOptionsModel := new(GetMirroringActiveTopicsOptions) + getMirroringActiveTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := adminrestService.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + adminrestService.EnableRetries(0, 0) + result, response, operationErr = adminrestService.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetMirroringActiveTopics(getMirroringActiveTopicsOptions *GetMirroringActiveTopicsOptions)`, func() { + getMirroringActiveTopicsPath := "/admin/mirroring/active-topics" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getMirroringActiveTopicsPath)) + Expect(req.Method).To(Equal("GET")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"active_topics": ["ActiveTopics"]}`) + })) + }) + It(`Invoke GetMirroringActiveTopics successfully with retries`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + adminrestService.EnableRetries(0, 0) + + // Construct an instance of the GetMirroringActiveTopicsOptions model + getMirroringActiveTopicsOptionsModel := new(GetMirroringActiveTopicsOptions) + getMirroringActiveTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := adminrestService.GetMirroringActiveTopicsWithContext(ctx, getMirroringActiveTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + adminrestService.DisableRetries() + result, response, operationErr := adminrestService.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = adminrestService.GetMirroringActiveTopicsWithContext(ctx, getMirroringActiveTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getMirroringActiveTopicsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"active_topics": ["ActiveTopics"]}`) + })) + }) + It(`Invoke GetMirroringActiveTopics successfully`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := adminrestService.GetMirroringActiveTopics(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetMirroringActiveTopicsOptions model + getMirroringActiveTopicsOptionsModel := new(GetMirroringActiveTopicsOptions) + getMirroringActiveTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = adminrestService.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetMirroringActiveTopics with error: Operation request error`, func() { + adminrestService, serviceErr := NewAdminrestV1(&AdminrestV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(adminrestService).ToNot(BeNil()) + + // Construct an instance of the GetMirroringActiveTopicsOptions model + getMirroringActiveTopicsOptionsModel := new(GetMirroringActiveTopicsOptions) + getMirroringActiveTopicsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := adminrestService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := adminrestService.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`Model constructor tests`, func() { + Context(`Using a service client instance`, func() { + adminrestService, _ := NewAdminrestV1(&AdminrestV1Options{ + URL: "http://adminrestv1modelgenerator.com", + Authenticator: &core.NoAuthAuthenticator{}, + }) + It(`Invoke NewCreateTopicOptions successfully`, func() { + // Construct an instance of the ConfigCreate model + configCreateModel := new(ConfigCreate) + Expect(configCreateModel).ToNot(BeNil()) + configCreateModel.Name = core.StringPtr("testString") + configCreateModel.Value = core.StringPtr("testString") + Expect(configCreateModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(configCreateModel.Value).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CreateTopicOptions model + createTopicOptionsModel := adminrestService.NewCreateTopicOptions() + createTopicOptionsModel.SetName("testString") + createTopicOptionsModel.SetPartitions(int64(26)) + createTopicOptionsModel.SetPartitionCount(int64(1)) + createTopicOptionsModel.SetConfigs([]ConfigCreate{*configCreateModel}) + createTopicOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createTopicOptionsModel).ToNot(BeNil()) + Expect(createTopicOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(createTopicOptionsModel.Partitions).To(Equal(core.Int64Ptr(int64(26)))) + Expect(createTopicOptionsModel.PartitionCount).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createTopicOptionsModel.Configs).To(Equal([]ConfigCreate{*configCreateModel})) + Expect(createTopicOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteTopicOptions successfully`, func() { + // Construct an instance of the DeleteTopicOptions model + topicName := "testString" + deleteTopicOptionsModel := adminrestService.NewDeleteTopicOptions(topicName) + deleteTopicOptionsModel.SetTopicName("testString") + deleteTopicOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteTopicOptionsModel).ToNot(BeNil()) + Expect(deleteTopicOptionsModel.TopicName).To(Equal(core.StringPtr("testString"))) + Expect(deleteTopicOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetMirroringActiveTopicsOptions successfully`, func() { + // Construct an instance of the GetMirroringActiveTopicsOptions model + getMirroringActiveTopicsOptionsModel := adminrestService.NewGetMirroringActiveTopicsOptions() + getMirroringActiveTopicsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getMirroringActiveTopicsOptionsModel).ToNot(BeNil()) + Expect(getMirroringActiveTopicsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetMirroringTopicSelectionOptions successfully`, func() { + // Construct an instance of the GetMirroringTopicSelectionOptions model + getMirroringTopicSelectionOptionsModel := adminrestService.NewGetMirroringTopicSelectionOptions() + getMirroringTopicSelectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getMirroringTopicSelectionOptionsModel).ToNot(BeNil()) + Expect(getMirroringTopicSelectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetTopicOptions successfully`, func() { + // Construct an instance of the GetTopicOptions model + topicName := "testString" + getTopicOptionsModel := adminrestService.NewGetTopicOptions(topicName) + getTopicOptionsModel.SetTopicName("testString") + getTopicOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getTopicOptionsModel).ToNot(BeNil()) + Expect(getTopicOptionsModel.TopicName).To(Equal(core.StringPtr("testString"))) + Expect(getTopicOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListTopicsOptions successfully`, func() { + // Construct an instance of the ListTopicsOptions model + listTopicsOptionsModel := adminrestService.NewListTopicsOptions() + listTopicsOptionsModel.SetTopicFilter("testString") + listTopicsOptionsModel.SetPerPage(int64(38)) + listTopicsOptionsModel.SetPage(int64(38)) + listTopicsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listTopicsOptionsModel).ToNot(BeNil()) + Expect(listTopicsOptionsModel.TopicFilter).To(Equal(core.StringPtr("testString"))) + Expect(listTopicsOptionsModel.PerPage).To(Equal(core.Int64Ptr(int64(38)))) + Expect(listTopicsOptionsModel.Page).To(Equal(core.Int64Ptr(int64(38)))) + Expect(listTopicsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewReplaceMirroringTopicSelectionOptions successfully`, func() { + // Construct an instance of the ReplaceMirroringTopicSelectionOptions model + replaceMirroringTopicSelectionOptionsModel := adminrestService.NewReplaceMirroringTopicSelectionOptions() + replaceMirroringTopicSelectionOptionsModel.SetIncludes([]string{"testString"}) + replaceMirroringTopicSelectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceMirroringTopicSelectionOptionsModel).ToNot(BeNil()) + Expect(replaceMirroringTopicSelectionOptionsModel.Includes).To(Equal([]string{"testString"})) + Expect(replaceMirroringTopicSelectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateTopicOptions successfully`, func() { + // Construct an instance of the ConfigUpdate model + configUpdateModel := new(ConfigUpdate) + Expect(configUpdateModel).ToNot(BeNil()) + configUpdateModel.Name = core.StringPtr("testString") + configUpdateModel.Value = core.StringPtr("testString") + configUpdateModel.ResetToDefault = core.BoolPtr(true) + Expect(configUpdateModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(configUpdateModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(configUpdateModel.ResetToDefault).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the UpdateTopicOptions model + topicName := "testString" + updateTopicOptionsModel := adminrestService.NewUpdateTopicOptions(topicName) + updateTopicOptionsModel.SetTopicName("testString") + updateTopicOptionsModel.SetNewTotalPartitionCount(int64(38)) + updateTopicOptionsModel.SetConfigs([]ConfigUpdate{*configUpdateModel}) + updateTopicOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateTopicOptionsModel).ToNot(BeNil()) + Expect(updateTopicOptionsModel.TopicName).To(Equal(core.StringPtr("testString"))) + Expect(updateTopicOptionsModel.NewTotalPartitionCount).To(Equal(core.Int64Ptr(int64(38)))) + Expect(updateTopicOptionsModel.Configs).To(Equal([]ConfigUpdate{*configUpdateModel})) + Expect(updateTopicOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + }) + }) + Describe(`Utility function tests`, func() { + It(`Invoke CreateMockByteArray() successfully`, func() { + mockByteArray := CreateMockByteArray("This is a test") + Expect(mockByteArray).ToNot(BeNil()) + }) + It(`Invoke CreateMockUUID() successfully`, func() { + mockUUID := CreateMockUUID("9fab83da-98cb-4f18-a7ba-b6f0435c9673") + Expect(mockUUID).ToNot(BeNil()) + }) + It(`Invoke CreateMockReader() successfully`, func() { + mockReader := CreateMockReader("This is a test.") + Expect(mockReader).ToNot(BeNil()) + }) + It(`Invoke CreateMockDate() successfully`, func() { + mockDate := CreateMockDate() + Expect(mockDate).ToNot(BeNil()) + }) + It(`Invoke CreateMockDateTime() successfully`, func() { + mockDateTime := CreateMockDateTime() + Expect(mockDateTime).ToNot(BeNil()) + }) + }) +}) + +// +// Utility functions used by the generated test code +// + +func CreateMockByteArray(mockData string) *[]byte { + ba := make([]byte, 0) + ba = append(ba, mockData...) + return &ba +} + +func CreateMockUUID(mockData string) *strfmt.UUID { + uuid := strfmt.UUID(mockData) + return &uuid +} + +func CreateMockReader(mockData string) io.ReadCloser { + return ioutil.NopCloser(bytes.NewReader([]byte(mockData))) +} + +func CreateMockDate() *strfmt.Date { + d := strfmt.Date(time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)) + return &d +} + +func CreateMockDateTime() *strfmt.DateTime { + d := strfmt.DateTime(time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)) + return &d +} + +func SetTestEnvironment(testEnvironment map[string]string) { + for key, value := range testEnvironment { + os.Setenv(key, value) + } +} + +func ClearTestEnvironment(testEnvironment map[string]string) { + for key := range testEnvironment { + os.Unsetenv(key) + } +} diff --git a/pkg/common/headers.go b/pkg/common/headers.go new file mode 100644 index 0000000..72ec52d --- /dev/null +++ b/pkg/common/headers.go @@ -0,0 +1,82 @@ +/** + * (C) Copyright IBM Corp. 2019, 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +import ( + "fmt" + "runtime" +) + +const ( + sdkName = "admin-rest-sdk" + headerNameUserAgent = "User-Agent" +) + +// +// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. +// +// This function is invoked by generated service methods (i.e. methods which implement the REST API operations +// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity +// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. +// This function is invoked for each invocation of a generated service method, +// so the set of HTTP headers could be request-specific. +// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this +// function, it is recommended that you initialize the returned map just once (perhaps by using +// lazy initialization) and simply return it each time the function is invoked, instead of building it each time +// as in the example below. +// +// If you plan to gather metrics for your SDK, the User-Agent header value must +// be a string similar to the following: +// eventstreams-go-sdk/1.0.0 (lang=go; arch=x86_64; os=Linux; go.version=1.12.9) +// +// In the example above, the analytics tool will parse the user-agent header and +// use the following properties: +// "eventstreams-go-sdk" - the name of your sdk +// "1.0.0"- the version of your sdk +// "lang=go" - the language of the current sdk +// "arch=x86_64; os=Linux; go.version=1.12.9" - system information +// +// Note: It is very important that the sdk name ends with the string `-sdk`, +// as the analytics data collector uses this to gather usage data. +// +// Parameters: +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// Returns: +// a Map which contains the set of headers to be included in the REST API request +// +func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { + sdkHeaders := make(map[string]string) + + sdkHeaders[headerNameUserAgent] = GetUserAgentInfo() + + return sdkHeaders +} + +var userAgent string = fmt.Sprintf("%s/%s %s", sdkName, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return userAgent +} + +var systemInfo = fmt.Sprintf("(lang=go; arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) + +func GetSystemInfo() string { + return systemInfo +} diff --git a/pkg/common/headers_test.go b/pkg/common/headers_test.go new file mode 100644 index 0000000..83cad02 --- /dev/null +++ b/pkg/common/headers_test.go @@ -0,0 +1,43 @@ +/** + * (C) Copyright IBM Corp. 2019, 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +import ( + "github.com/stretchr/testify/assert" + "strings" + "testing" +) + +func TestGetSystemInfo(t *testing.T) { + var sysinfo = GetSystemInfo() + assert.NotNil(t, sysinfo) + assert.True(t, strings.Contains(sysinfo, "lang=")) + assert.True(t, strings.Contains(sysinfo, "arch=")) + assert.True(t, strings.Contains(sysinfo, "os=")) + assert.True(t, strings.Contains(sysinfo, "go.version=")) +} + +func TestGetSdkHeaders(t *testing.T) { + var headers = GetSdkHeaders("myService", "v123", "myOperation") + assert.NotNil(t, headers) + + var foundIt bool + + _, foundIt = headers[headerNameUserAgent] + assert.True(t, foundIt) + t.Logf("user agent: %s\n", headers[headerNameUserAgent]) +} diff --git a/pkg/common/version.go b/pkg/common/version.go new file mode 100644 index 0000000..a4fc210 --- /dev/null +++ b/pkg/common/version.go @@ -0,0 +1,20 @@ +/** + * (C) Copyright IBM Corp. 2019, 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +// Version of the SDK +const Version = "__VERSION__"