diff --git a/harness/dbops/.gitignore b/harness/dbops/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/harness/dbops/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/harness/dbops/.swagger-codegen-ignore b/harness/dbops/.swagger-codegen-ignore new file mode 100644 index 00000000..c5fa491b --- /dev/null +++ b/harness/dbops/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# 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 Swagger Codgen 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/harness/dbops/.swagger-codegen/VERSION b/harness/dbops/.swagger-codegen/VERSION new file mode 100644 index 00000000..e661578d --- /dev/null +++ b/harness/dbops/.swagger-codegen/VERSION @@ -0,0 +1 @@ +3.0.57 \ No newline at end of file diff --git a/harness/dbops/.travis.yml b/harness/dbops/.travis.yml new file mode 100644 index 00000000..f5cb2ce9 --- /dev/null +++ b/harness/dbops/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/harness/dbops/README.md b/harness/dbops/README.md new file mode 100644 index 00000000..7bca1caa --- /dev/null +++ b/harness/dbops/README.md @@ -0,0 +1,69 @@ +# Go API client for swagger + +This is the Open Api Spec 3 for the DB Service + +## Overview +This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. + +- API version: 1.0 +- Package version: 1.0.0 +- Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen + +## Installation +Put the package under your project folder and add the following in import: +```golang +import "./swagger" +``` + +## Documentation for API Endpoints + +All URIs are relative to */* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DatabaseInstanceApi* | [**V1CreateProjDbSchemaInstance**](docs/DatabaseInstanceApi.md#v1createprojdbschemainstance) | **Post** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance | Create a database instance +*DatabaseInstanceApi* | [**V1DeleteProjDbSchemaInstance**](docs/DatabaseInstanceApi.md#v1deleteprojdbschemainstance) | **Delete** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance} | Delete a database instance +*DatabaseInstanceApi* | [**V1GetProjDbSchemaInstance**](docs/DatabaseInstanceApi.md#v1getprojdbschemainstance) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance} | Get a database instance +*DatabaseInstanceApi* | [**V1ListProjDbSchemaInstance**](docs/DatabaseInstanceApi.md#v1listprojdbschemainstance) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance | List database instances +*DatabaseSchemaApi* | [**V1CreateProjDbSchema**](docs/DatabaseSchemaApi.md#v1createprojdbschema) | **Post** /v1/orgs/{org}/projects/{project}/dbschema | Create a database schema +*DatabaseSchemaApi* | [**V1DeleteProjDbSchema**](docs/DatabaseSchemaApi.md#v1deleteprojdbschema) | **Delete** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema} | Delete a database schema +*DatabaseSchemaApi* | [**V1GetProjDbSchema**](docs/DatabaseSchemaApi.md#v1getprojdbschema) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema} | Get a database schema +*DatabaseSchemaApi* | [**V1ListProjDbSchema**](docs/DatabaseSchemaApi.md#v1listprojdbschema) | **Get** /v1/orgs/{org}/projects/{project}/dbschema | List database schemas +*DatabaseSchemaApi* | [**V1UpdateProjDbSchema**](docs/DatabaseSchemaApi.md#v1updateprojdbschema) | **Put** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema} | Update a database schema +*DatabaseSchemaApi* | [**V1UpdateProjDbSchemaInstance**](docs/DatabaseSchemaApi.md#v1updateprojdbschemainstance) | **Put** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance} | Update a database instance +*LogIngestApi* | [**V1GetDbinstanceLog**](docs/LogIngestApi.md#v1getdbinstancelog) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}/logs/{log} | +*LogIngestApi* | [**V1IngestLogs**](docs/LogIngestApi.md#v1ingestlogs) | **Post** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}/logs | Ingest database migration logs +*PipelineStepApi* | [**ConsumeV1StepPluginResponse**](docs/PipelineStepApi.md#consumev1steppluginresponse) | **Post** /v1/step/plugin-response | ConsumePluginResponse +*PipelineStepApi* | [**CreateV1StepPluginInputs**](docs/PipelineStepApi.md#createv1stepplugininputs) | **Post** /v1/step/plugin-inputs | CreatePluginInputs + +## Documentation For Models + + - [Changelog](docs/Changelog.md) + - [Command](docs/Command.md) + - [CommandExecutionStatus](docs/CommandExecutionStatus.md) + - [DbInstanceIn](docs/DbInstanceIn.md) + - [DbInstanceOut](docs/DbInstanceOut.md) + - [DbSchemaIn](docs/DbSchemaIn.md) + - [DbSchemaOut](docs/DbSchemaOut.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [ModelError](docs/ModelError.md) + - [ParsedLogOut](docs/ParsedLogOut.md) + +## Documentation For Authorization + +## Authorization +## x-api-key +- **Type**: API key + +Example +```golang +auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. +}) +r, err := client.Service.Operation(auth, args) +``` + +## Author + +contact@harness.io diff --git a/harness/dbops/api/swagger.yaml b/harness/dbops/api/swagger.yaml new file mode 100644 index 00000000..ac669ca7 --- /dev/null +++ b/harness/dbops/api/swagger.yaml @@ -0,0 +1,1992 @@ +openapi: 3.0.0 +info: + title: Harness NextGen Software Delivery Platform API Reference + description: This is the Open Api Spec 3 for the DB Service + contact: + email: contact@harness.io + version: "1.0" +servers: +- url: / +tags: +- name: Database Schema + description: This contains APIs for performing CRUD operations on Database Schema + Entity + x-displayName: Database Schema +- name: Database Instance + description: This contains APIs for performing CRUD operations on Database Instance + Entity + x-displayName: Database Instance +- name: Log Ingest + description: This contains APIs for creating and retrieving database migration log + information + x-displayName: Log Ingest +- name: Pipeline Step + description: This contains APIs for Pipeline Plugin Inputs + x-displayName: Pipeline Step +paths: + /v1/orgs/{org}/projects/{project}/dbschema: + get: + tags: + - Database Schema + summary: List database schemas + description: List database Schemas + operationId: V1ListProjDbSchema + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + - name: page + in: query + description: "Pagination page number strategy: Specify the page number within\ + \ the paginated collection related to the number of items on each page." + required: false + style: form + explode: true + schema: + type: integer + format: int64 + default: 0 + - name: limit + in: query + description: "Pagination: Number of items to return." + required: false + style: form + explode: true + schema: + maximum: 100 + type: integer + default: 10 + - name: search_term + in: query + description: This would be used to filter resources having attributes matching + the search term. + required: false + allowEmptyValue: true + style: form + explode: true + schema: + type: string + - name: sort + in: query + description: Parameter on the basis of which sorting is done. + required: false + style: form + explode: true + schema: + type: string + enum: + - name + - updated + - created + - name: order + in: query + description: Order on the basis of which sorting is done. + required: false + style: form + explode: true + schema: + type: string + enum: + - ASC + - DESC + responses: + "200": + description: Response body for List Database Schema + headers: + X-Page-Number: + description: Page number in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Page-Size: + description: Maximum page size in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Total-Elements: + description: Total number of elements returned in Paginated response. + style: simple + explode: false + schema: + type: integer + content: + application/json: + schema: + type: array + description: Response body for List Schema + items: + $ref: '#/components/schemas/DBSchemaOut' + x-content-type: application/json + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-internal: false + x-stoplight: + id: nhhnhieu7jo8u + post: + tags: + - Database Schema + summary: Create a database schema + description: Create a database schema + operationId: V1CreateProjDbSchema + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/DBSchemaCreateRequest' + responses: + "201": + description: Response body for Database Schema + content: + application/json: + schema: + $ref: '#/components/schemas/DBSchemaOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: 1ip5gikvmqezd + /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}: + get: + tags: + - Database Schema + summary: Get a database schema + description: Retrieves the specified database schema + operationId: V1GetProjDbSchema + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + responses: + "200": + description: Response body for Database Schema + content: + application/json: + schema: + $ref: '#/components/schemas/DBSchemaOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: 78fzlqtzyti7q + put: + tags: + - Database Schema + summary: Update a database schema + description: Update a database schema + operationId: V1UpdateProjDbSchema + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/DBSchemaUpdateRequest' + responses: + "200": + description: Response body for Database Schema + content: + application/json: + schema: + $ref: '#/components/schemas/DBSchemaOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: ngsm9f0c6fvq5 + delete: + tags: + - Database Schema + summary: Delete a database schema + description: Delete a database schema + operationId: V1DeleteProjDbSchema + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + responses: + "204": + description: The database schema was deleted successfully + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: ek4jolzg7diy6 + /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance: + get: + tags: + - Database Instance + summary: List database instances + description: Retrieves the specified database instances of the database schema + operationId: V1ListProjDbSchemaInstance + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + - name: page + in: query + description: "Pagination page number strategy: Specify the page number within\ + \ the paginated collection related to the number of items on each page." + required: false + style: form + explode: true + schema: + type: integer + format: int64 + default: 0 + - name: limit + in: query + description: "Pagination: Number of items to return." + required: false + style: form + explode: true + schema: + maximum: 100 + type: integer + default: 10 + - name: search_term + in: query + description: This would be used to filter resources having attributes matching + the search term. + required: false + allowEmptyValue: true + style: form + explode: true + schema: + type: string + - name: sort + in: query + description: Parameter on the basis of which sorting is done. + required: false + style: form + explode: true + schema: + type: string + enum: + - name + - updated + - created + - name: order + in: query + description: Order on the basis of which sorting is done. + required: false + style: form + explode: true + schema: + type: string + enum: + - ASC + - DESC + responses: + "200": + description: Response body for List Database Schema + headers: + X-Page-Number: + description: Page number in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Page-Size: + description: Maximum page size in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Total-Elements: + description: Total number of elements returned in Paginated response. + style: simple + explode: false + schema: + type: integer + content: + application/json: + schema: + type: array + description: Response body for List Schema + items: + $ref: '#/components/schemas/DBInstanceOut' + x-content-type: application/json + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: zd2ila1mx2t7c + post: + tags: + - Database Instance + summary: Create a database instance + description: Create a database instance + operationId: V1CreateProjDbSchemaInstance + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/DBInstanceCreateRequest' + responses: + "201": + description: Response body for Database Instance + content: + application/json: + schema: + $ref: '#/components/schemas/DBInstanceOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: ooxjel6o3ya8y + /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}: + get: + tags: + - Database Instance + summary: Get a database instance + description: Retrieves the specified database instance + operationId: V1GetProjDbSchemaInstance + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: dbinstance + in: path + description: database instance unique id + required: true + style: simple + explode: false + schema: + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + responses: + "200": + description: Response body for Database Instance + content: + application/json: + schema: + $ref: '#/components/schemas/DBInstanceOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: tcua2vmx132hm + put: + tags: + - Database Schema + summary: Update a database instance + description: Update a database instance + operationId: V1UpdateProjDbSchemaInstance + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: dbinstance + in: path + description: database instance unique id + required: true + style: simple + explode: false + schema: + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/DBInstanceUpdateRequest' + responses: + "200": + description: Response body for Database Instance + content: + application/json: + schema: + $ref: '#/components/schemas/DBInstanceOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: e17endbbc7uha + delete: + tags: + - Database Instance + summary: Delete a database instance + description: Delete a database instance + operationId: V1DeleteProjDbSchemaInstance + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: dbinstance + in: path + description: database instance unique id + required: true + style: simple + explode: false + schema: + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + responses: + "204": + description: The database instance was deleted successfully + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: hx4uvpfwg2w2c + /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}/logs: + post: + tags: + - Log Ingest + summary: Ingest database migration logs + description: Ingest database migration logs to update the state of the database + operationId: V1IngestLogs + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: dbinstance + in: path + description: database instance unique id + required: true + style: simple + explode: false + schema: + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/LogIngestRequest' + responses: + "201": + description: Response body for Log Event + content: + application/json: + schema: + $ref: '#/components/schemas/ParsedLogOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-internal: true + x-stoplight: + id: n6q91b59w1kld + /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}/logs/{log}: + get: + tags: + - Log Ingest + description: Retrieves the specified log event + operationId: V1GetDbinstanceLog + parameters: + - name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + - name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + - name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + - name: dbinstance + in: path + description: database instance unique id + required: true + style: simple + explode: false + schema: + type: string + - name: log + in: path + required: true + style: simple + explode: false + schema: + type: string + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + responses: + "200": + description: Response body for Log Event + content: + application/json: + schema: + $ref: '#/components/schemas/ParsedLogOut' + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-stoplight: + id: 9o2dqka7km06p + /v1/step/plugin-inputs: + post: + tags: + - Pipeline Step + summary: CreatePluginInputs + description: Create Plugin Inputs using Step Inputs + operationId: CreateV1StepPluginInputs + parameters: + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/PluginStepInputsRequest' + responses: + "200": + description: Plugin Inputs Create Response + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200' + examples: + Example 1: + value: + image: plugins/drone-liquibase:latest + settings: + property1: string + property2: string + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-internal: true + /v1/step/plugin-response: + post: + tags: + - Pipeline Step + summary: ConsumePluginResponse + description: Consume Plugin Execution Response + operationId: ConsumeV1StepPluginResponse + parameters: + - name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header.\ + \ If you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/ConsumePluginRespRequest' + responses: + "204": + description: The plugin execution response was acknowledged + "400": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "403": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "500": + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-internal: true +components: + schemas: + Changelog: + required: + - connector + - location + type: object + properties: + connector: + minLength: 1 + type: string + description: identifier of the harness git connector + example: harness_git + location: + minLength: 1 + type: string + description: path to the change log file + example: folder/changelog.yaml + repo: + minLength: 1 + type: string + description: repo name of the git based connector when ConnectionType is + Account + example: folder/changelog.yaml + x-stoplight: + id: pw3ul0rkm8xt6 + additionalProperties: false + description: | + location of the changelog file containing schema changes in a git repository + example: + connector: harness_git + repo: folder/changelog.yaml + location: folder/changelog.yaml + x-stoplight: + id: y6w8wjhgkcmvb + Command: + title: Command + minLength: 1 + type: string + description: Type of the plugin command to run + enum: + - Update + - Validate + - History + - Tag + - Rollback + x-internal: true + x-stoplight: + id: qkhbmferrwa3c + CommandExecutionStatus: + title: CommandExecutionStatus + type: string + enum: + - IN_PROGRESS + - SUCCESS + - FAILURE + DBInstanceIn: + title: Database Instance Request + required: + - branch + - connector + - identifier + type: object + properties: + branch: + minLength: 1 + type: string + description: | + branch where the instance is stored + example: main + connector: + minLength: 1 + type: string + description: DB Connector + example: postgres-connector + context: + type: string + description: Liquibase context + identifier: + pattern: "^[a-zA-Z_][0-9a-zA-Z_$]{0,127}$" + type: string + description: identifier of the database instance + x-oapi-codegen-extra-tags: + validate: "required,max=128" + name: + type: string + description: name of the database instance + x-oapi-codegen-extra-tags: + validate: "required,max=128" + tags: + maxProperties: 128 + type: object + additionalProperties: + type: string + x-oapi-codegen-extra-tags: + validate: max=128 + description: tags attached to the database instance + x-go-type-skip-optional-pointer: true + description: Database Instance Request + x-stoplight: + id: kxem398e633y6 + DBInstanceOut: + title: Database Instance Response + required: + - branch + - connector + - created + - identifier + - name + type: object + properties: + branch: + type: string + description: branch where the instance is stored + connector: + type: string + description: DB Connector + context: + type: string + description: Liquibase context + created: + type: integer + description: epoch seconds when the database instance was created + format: int64 + identifier: + type: string + description: identifier of the database instance + lastAppliedTag: + type: string + description: Most recent tag applied to the database + name: + type: string + description: name of the database instance + tags: + type: object + additionalProperties: + type: string + description: tags attached to the database instance + x-go-type-skip-optional-pointer: true + updated: + type: integer + description: epoch seconds when the database instance was last updated + format: int64 + description: Database Instance Response + example: + identifier: identifier + connector: connector + created: 0 + context: context + name: name + lastAppliedTag: lastAppliedTag + branch: branch + updated: 6 + tags: + key: tags + x-stoplight: + id: 5m8aehg7pes2b + DBSchemaIn: + title: Database Schema Request + required: + - changelog + - identifier + - name + type: object + properties: + changelog: + $ref: '#/components/schemas/Changelog' + identifier: + pattern: "^[a-zA-Z_][0-9a-zA-Z_$]{0,127}$" + type: string + description: identifier of the database schema + x-oapi-codegen-extra-tags: + validate: "required,max=128" + name: + type: string + description: name of the database schema + x-oapi-codegen-extra-tags: + validate: "required,max=128" + service: + minLength: 1 + type: string + description: | + harness service corresponding to database schema + example: harness_service + tags: + maxProperties: 128 + type: object + additionalProperties: + type: string + x-oapi-codegen-extra-tags: + validate: max=128 + description: tags attached to the database schema + x-go-type-skip-optional-pointer: true + description: 'Database Schema Request ' + x-examples: + Example 1: + changelog: + connector: harness_git + location: folder/changelog.yaml + identifier: myservice_database + name: my service database + service: harness_service + tags: + region: us-east-1 + x-stoplight: + id: h7o3p1i7x70kl + DBSchemaOut: + title: Database Schema Response + required: + - changelog + - created + - identifier + - instanceCount + - name + type: object + properties: + changelog: + $ref: '#/components/schemas/Changelog' + created: + type: integer + description: epoch seconds when the database schema was created + format: int64 + identifier: + type: string + description: identifier of the database schema + instanceCount: + type: integer + description: number of database instances corresponding to database schema + format: int64 + name: + type: string + description: name of the database schema + service: + type: string + description: harness service corresponding to database schema + tags: + type: object + additionalProperties: + type: string + description: tags attached to the database schema + x-go-type-skip-optional-pointer: true + updated: + type: integer + description: epoch seconds when the database schema was last updated + format: int64 + description: Database Schema Response + example: + identifier: identifier + created: 0 + instanceCount: 6 + service: service + name: name + changelog: + connector: harness_git + repo: folder/changelog.yaml + location: folder/changelog.yaml + updated: 1 + tags: + key: tags + x-stoplight: + id: 1hr1r7yfnuogq + Error: + title: Error Response + required: + - message + type: object + properties: + message: + type: string + description: error message detail + description: Error Response + x-stoplight: + id: rfbq36xohx3fa + ParsedLogOut: + title: Ingest Log + required: + - command + - id + - success + type: object + properties: + command: + type: string + id: + type: string + description: identifier of the logIngest entity + success: + type: boolean + example: + success: true + id: id + command: command + x-stoplight: + id: mc52t3ltfxg9s + inline_response_200: + type: object + properties: + image: + type: string + instance: + $ref: '#/components/schemas/DBInstanceOut' + schema: + $ref: '#/components/schemas/DBSchemaOut' + settings: + type: object + additionalProperties: + type: string + example: + schema: + identifier: identifier + created: 0 + instanceCount: 6 + service: service + name: name + changelog: + connector: harness_git + repo: folder/changelog.yaml + location: folder/changelog.yaml + updated: 1 + tags: + key: tags + image: image + settings: + key: settings + instance: + identifier: identifier + connector: connector + created: 0 + context: context + name: name + lastAppliedTag: lastAppliedTag + branch: branch + updated: 6 + tags: + key: tags + responses: + DBInstanceListResponse: + description: Response body for List Database Schema + headers: + X-Page-Number: + description: Page number in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Page-Size: + description: Maximum page size in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Total-Elements: + description: Total number of elements returned in Paginated response. + style: simple + explode: false + schema: + type: integer + content: + application/json: + schema: + type: array + description: Response body for List Schema + items: + $ref: '#/components/schemas/DBInstanceOut' + x-content-type: application/json + DBInstanceResponse: + description: Response body for Database Instance + content: + application/json: + schema: + $ref: '#/components/schemas/DBInstanceOut' + DBSchemaListResponse: + description: Response body for List Database Schema + headers: + X-Page-Number: + description: Page number in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Page-Size: + description: Maximum page size in Paginated response. + style: simple + explode: false + schema: + type: integer + X-Total-Elements: + description: Total number of elements returned in Paginated response. + style: simple + explode: false + schema: + type: integer + content: + application/json: + schema: + type: array + description: Response body for List Schema + items: + $ref: '#/components/schemas/DBSchemaOut' + x-content-type: application/json + DBSchemaResponse: + description: Response body for Database Schema + content: + application/json: + schema: + $ref: '#/components/schemas/DBSchemaOut' + ErrorResponse: + description: Error Response body + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + ParsedLogResponse: + description: Response body for Log Event + content: + application/json: + schema: + $ref: '#/components/schemas/ParsedLogOut' + PluginInputsResponse: + description: Plugin Inputs Create Response + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200' + examples: + Example 1: + value: + image: plugins/drone-liquibase:latest + settings: + property1: string + property2: string + parameters: + AccountHeader: + name: Harness-Account + in: header + description: "Identifier field of the account the resource is scoped to. This\ + \ is required for Authorization methods other than the x-api-key header. If\ + \ you are using the x-api-key header, this can be skipped." + required: false + style: simple + explode: false + schema: + type: string + DBInstanceParam: + name: dbinstance + in: path + description: database instance unique id + required: true + style: simple + explode: false + schema: + type: string + DBSchemaParam: + name: dbschema + in: path + description: Identifier of the database schema + required: true + style: simple + explode: false + schema: + maxLength: 128 + type: string + Limit: + name: limit + in: query + description: "Pagination: Number of items to return." + required: false + style: form + explode: true + schema: + maximum: 100 + type: integer + default: 10 + LogParam: + name: log + in: path + required: true + style: simple + explode: false + schema: + type: string + Order: + name: order + in: query + description: Order on the basis of which sorting is done. + required: false + style: form + explode: true + schema: + type: string + enum: + - ASC + - DESC + OrgParam: + name: org + in: path + description: Organization identifier + required: true + style: simple + explode: false + schema: + type: string + PageIndex: + name: page + in: query + description: "Pagination page number strategy: Specify the page number within\ + \ the paginated collection related to the number of items on each page." + required: false + style: form + explode: true + schema: + type: integer + format: int64 + default: 0 + ProjectParam: + name: project + in: path + description: Project identifier + required: true + style: simple + explode: false + schema: + type: string + SearchTerm: + name: search_term + in: query + description: This would be used to filter resources having attributes matching + the search term. + required: false + allowEmptyValue: true + style: form + explode: true + schema: + type: string + Sort: + name: sort + in: query + description: Parameter on the basis of which sorting is done. + required: false + style: form + explode: true + schema: + type: string + enum: + - name + - updated + - created + requestBodies: + ConsumePluginRespRequest: + content: + application/json: + schema: + required: + - command + - data + - dbInstance + - dbSchema + - logs + - org + - project + - status + type: object + properties: + command: + $ref: '#/components/schemas/Command' + data: + type: object + description: Data associated with command execution + x-stoplight: + id: x106nmejwdkgl + dbInstance: + type: string + x-stoplight: + id: 3ddzm85isheyg + dbSchema: + type: string + x-stoplight: + id: 9dipu2aap5uz2 + logs: + type: string + x-stoplight: + id: 8lr1r6lycw0fj + org: + type: string + description: Organization identifier + project: + type: string + description: Project identifier + status: + $ref: '#/components/schemas/CommandExecutionStatus' + examples: + Example 1: + value: + command: Update + data: + tag: "1.0" + dbinstance: myinstance + dbschema: myschema + logs: Starting Liquibase at... + org: myorg + project: myproject + status: IN_PROGRESS + DBInstanceCreateRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/DBInstanceIn' + required: true + DBInstanceUpdateRequest: + description: Database instance update request + content: + application/json: + schema: + type: object + properties: + branch: + type: string + description: branch where the instance is stored + connector: + type: string + description: DB Connector + context: + type: string + description: Liquibase context + name: + maxLength: 128 + type: string + description: | + name of the database instance + tags: + maxProperties: 128 + type: object + additionalProperties: + type: string + x-oapi-codegen-extra-tags: + validate: max=128 + description: Database instance tags + version: + type: string + description: version of the changelog applied to the database + examples: + example-1: + value: + branch: string + connector: string + context: string + name: string + tags: + property1: string + property2: string + required: true + DBSchemaCreateRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/DBSchemaIn' + required: true + DBSchemaUpdateRequest: + description: Database schema update request + content: + application/json: + schema: + type: object + properties: + changelog: + type: object + properties: + connector: + type: string + description: identifier of the harness git connector + example: harness_git + location: + type: string + description: path to the change log file + example: folder/changelog.yaml + repo: + type: string + description: repo name of the git based connector when ConnectionType + is Account + x-stoplight: + id: jpl7puzto8jfo + additionalProperties: false + description: | + location of the changelog file containing schema changes in a git repository + name: + maxLength: 128 + type: string + description: | + name of the database schema + service: + type: string + description: | + harness service corresponding to database schema + example: harness_service + tags: + maxProperties: 128 + type: object + additionalProperties: + type: string + x-oapi-codegen-extra-tags: + validate: max=128 + description: Database Schema tags + required: true + LogIngestRequest: + description: Request body for log ingestion + content: + text/plain: + schema: + type: string + description: raw text logs from plugin + required: true + PluginStepInputsRequest: + description: Inputs to create plugin inputs + content: + application/json: + schema: + required: + - command + - dbInstance + - dbSchema + type: object + properties: + Org: + type: string + description: Organization identifier + Project: + type: string + description: Project identifier + command: + $ref: '#/components/schemas/Command' + dbInstance: + type: string + description: db instance identifier + example: myschema/prod-1-instance + dbSchema: + type: string + description: dbSchema reference + x-stoplight: + id: saiftwb6u1v5i + directory: + type: string + metadata: + type: object + properties: + plan_execution: + type: string + x-stoplight: + id: 2dzzmp165gswr + step_identifier: + type: string + x-stoplight: + id: 9biv5d574s7wr + x-stoplight: + id: p0fia99dekvt4 + settings: + type: object + additionalProperties: + type: string + x-stoplight: + id: zqkdd4n7n4nay + description: Key value mapping of user input plugin settings + x-stoplight: + id: f7g438c5t4whg + examples: + Example 1: + value: + command: Update + dbInstance: prod-1-instance + dbSchema: myschema + directory: myDir + metadata: + plan_execution: 120dand330dp2 + step_identifier: my_apply_step + tag: tag1 + required: true + securitySchemes: + Authorization: + type: http + scheme: bearer + x-api-key: + type: apiKey + name: API Key + in: header +x-stoplight: + id: 9tufvhvklyjrk diff --git a/harness/dbops/api_database_instance.go b/harness/dbops/api_database_instance.go new file mode 100644 index 00000000..268f548e --- /dev/null +++ b/harness/dbops/api_database_instance.go @@ -0,0 +1,613 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type DatabaseInstanceApiService service + +/* +DatabaseInstanceApiService Create a database instance +Create a database instance + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param optional nil or *DatabaseInstanceApiV1CreateProjDbSchemaInstanceOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. +@return DbInstanceOut +*/ + +type DatabaseInstanceApiV1CreateProjDbSchemaInstanceOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseInstanceApiService) V1CreateProjDbSchemaInstance(ctx context.Context, body DbInstanceIn, org string, project string, dbschema string, localVarOptionals *DatabaseInstanceApiV1CreateProjDbSchemaInstanceOpts) (DbInstanceOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue DbInstanceOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return localVarReturnValue, nil, reportError("dbschema must have less than 128 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v DbInstanceOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DatabaseInstanceApiService Delete a database instance +Delete a database instance + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param dbinstance database instance unique id + * @param optional nil or *DatabaseInstanceApiV1DeleteProjDbSchemaInstanceOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. + +*/ + +type DatabaseInstanceApiV1DeleteProjDbSchemaInstanceOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseInstanceApiService) V1DeleteProjDbSchemaInstance(ctx context.Context, org string, project string, dbschema string, dbinstance string, localVarOptionals *DatabaseInstanceApiV1DeleteProjDbSchemaInstanceOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbinstance"+"}", fmt.Sprintf("%v", dbinstance), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return nil, reportError("dbschema must have less than 128 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +DatabaseInstanceApiService Get a database instance +Retrieves the specified database instance + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param dbinstance database instance unique id + * @param optional nil or *DatabaseInstanceApiV1GetProjDbSchemaInstanceOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. +@return DbInstanceOut +*/ + +type DatabaseInstanceApiV1GetProjDbSchemaInstanceOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseInstanceApiService) V1GetProjDbSchemaInstance(ctx context.Context, org string, project string, dbschema string, dbinstance string, localVarOptionals *DatabaseInstanceApiV1GetProjDbSchemaInstanceOpts) (DbInstanceOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue DbInstanceOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbinstance"+"}", fmt.Sprintf("%v", dbinstance), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return localVarReturnValue, nil, reportError("dbschema must have less than 128 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v DbInstanceOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DatabaseInstanceApiService List database instances +Retrieves the specified database instances of the database schema + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param optional nil or *DatabaseInstanceApiV1ListProjDbSchemaInstanceOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. + * @param "Page" (optional.Int64) - Pagination page number strategy: Specify the page number within the paginated collection related to the number of items on each page. + * @param "Limit" (optional.Int32) - Pagination: Number of items to return. + * @param "SearchTerm" (optional.String) - This would be used to filter resources having attributes matching the search term. + * @param "Sort" (optional.String) - Parameter on the basis of which sorting is done. + * @param "Order" (optional.String) - Order on the basis of which sorting is done. +@return []DbInstanceOut +*/ + +type DatabaseInstanceApiV1ListProjDbSchemaInstanceOpts struct { + HarnessAccount optional.String + Page optional.Int64 + Limit optional.Int32 + SearchTerm optional.String + Sort optional.String + Order optional.String +} + +func (a *DatabaseInstanceApiService) V1ListProjDbSchemaInstance(ctx context.Context, org string, project string, dbschema string, localVarOptionals *DatabaseInstanceApiV1ListProjDbSchemaInstanceOpts) ([]DbInstanceOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []DbInstanceOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return localVarReturnValue, nil, reportError("dbschema must have less than 128 elements") + } + + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SearchTerm.IsSet() { + localVarQueryParams.Add("search_term", parameterToString(localVarOptionals.SearchTerm.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sort.IsSet() { + localVarQueryParams.Add("sort", parameterToString(localVarOptionals.Sort.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []DbInstanceOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/harness/dbops/api_database_schema.go b/harness/dbops/api_database_schema.go new file mode 100644 index 00000000..ca8a670c --- /dev/null +++ b/harness/dbops/api_database_schema.go @@ -0,0 +1,898 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type DatabaseSchemaApiService service + +/* +DatabaseSchemaApiService Create a database schema +Create a database schema + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param org Organization identifier + * @param project Project identifier + * @param optional nil or *DatabaseSchemaApiV1CreateProjDbSchemaOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. +@return DbSchemaOut +*/ + +type DatabaseSchemaApiV1CreateProjDbSchemaOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseSchemaApiService) V1CreateProjDbSchema(ctx context.Context, body DbSchemaIn, org string, project string, localVarOptionals *DatabaseSchemaApiV1CreateProjDbSchemaOpts) (DbSchemaOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue DbSchemaOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v DbSchemaOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DatabaseSchemaApiService Delete a database schema +Delete a database schema + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param optional nil or *DatabaseSchemaApiV1DeleteProjDbSchemaOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. + +*/ + +type DatabaseSchemaApiV1DeleteProjDbSchemaOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseSchemaApiService) V1DeleteProjDbSchema(ctx context.Context, org string, project string, dbschema string, localVarOptionals *DatabaseSchemaApiV1DeleteProjDbSchemaOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return nil, reportError("dbschema must have less than 128 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +DatabaseSchemaApiService Get a database schema +Retrieves the specified database schema + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param optional nil or *DatabaseSchemaApiV1GetProjDbSchemaOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. +@return DbSchemaOut +*/ + +type DatabaseSchemaApiV1GetProjDbSchemaOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseSchemaApiService) V1GetProjDbSchema(ctx context.Context, org string, project string, dbschema string, localVarOptionals *DatabaseSchemaApiV1GetProjDbSchemaOpts) (DbSchemaOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue DbSchemaOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return localVarReturnValue, nil, reportError("dbschema must have less than 128 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v DbSchemaOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DatabaseSchemaApiService List database schemas +List database Schemas + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param org Organization identifier + * @param project Project identifier + * @param optional nil or *DatabaseSchemaApiV1ListProjDbSchemaOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. + * @param "Page" (optional.Int64) - Pagination page number strategy: Specify the page number within the paginated collection related to the number of items on each page. + * @param "Limit" (optional.Int32) - Pagination: Number of items to return. + * @param "SearchTerm" (optional.String) - This would be used to filter resources having attributes matching the search term. + * @param "Sort" (optional.String) - Parameter on the basis of which sorting is done. + * @param "Order" (optional.String) - Order on the basis of which sorting is done. +@return []DbSchemaOut +*/ + +type DatabaseSchemaApiV1ListProjDbSchemaOpts struct { + HarnessAccount optional.String + Page optional.Int64 + Limit optional.Int32 + SearchTerm optional.String + Sort optional.String + Order optional.String +} + +func (a *DatabaseSchemaApiService) V1ListProjDbSchema(ctx context.Context, org string, project string, localVarOptionals *DatabaseSchemaApiV1ListProjDbSchemaOpts) ([]DbSchemaOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []DbSchemaOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Page.IsSet() { + localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SearchTerm.IsSet() { + localVarQueryParams.Add("search_term", parameterToString(localVarOptionals.SearchTerm.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Sort.IsSet() { + localVarQueryParams.Add("sort", parameterToString(localVarOptionals.Sort.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []DbSchemaOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DatabaseSchemaApiService Update a database schema +Update a database schema + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Database schema update request + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param optional nil or *DatabaseSchemaApiV1UpdateProjDbSchemaOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. +@return DbSchemaOut +*/ + +type DatabaseSchemaApiV1UpdateProjDbSchemaOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseSchemaApiService) V1UpdateProjDbSchema(ctx context.Context, body interface{}, org string, project string, dbschema string, localVarOptionals *DatabaseSchemaApiV1UpdateProjDbSchemaOpts) (DbSchemaOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue DbSchemaOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return localVarReturnValue, nil, reportError("dbschema must have less than 128 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v DbSchemaOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +DatabaseSchemaApiService Update a database instance +Update a database instance + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Database instance update request + * @param org Organization identifier + * @param project Project identifier + * @param dbschema Identifier of the database schema + * @param dbinstance database instance unique id + * @param optional nil or *DatabaseSchemaApiV1UpdateProjDbSchemaInstanceOpts - Optional Parameters: + * @param "HarnessAccount" (optional.String) - Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. +@return DbInstanceOut +*/ + +type DatabaseSchemaApiV1UpdateProjDbSchemaInstanceOpts struct { + HarnessAccount optional.String +} + +func (a *DatabaseSchemaApiService) V1UpdateProjDbSchemaInstance(ctx context.Context, body interface{}, org string, project string, dbschema string, dbinstance string, localVarOptionals *DatabaseSchemaApiV1UpdateProjDbSchemaInstanceOpts) (DbInstanceOut, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue DbInstanceOut + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}" + localVarPath = strings.Replace(localVarPath, "{"+"org"+"}", fmt.Sprintf("%v", org), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project"+"}", fmt.Sprintf("%v", project), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbschema"+"}", fmt.Sprintf("%v", dbschema), -1) + localVarPath = strings.Replace(localVarPath, "{"+"dbinstance"+"}", fmt.Sprintf("%v", dbinstance), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(dbschema) > 128 { + return localVarReturnValue, nil, reportError("dbschema must have less than 128 elements") + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.HarnessAccount.IsSet() { + localVarHeaderParams["Harness-Account"] = parameterToString(localVarOptionals.HarnessAccount.Value(), "") + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v DbInstanceOut + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/harness/dbops/client.go b/harness/dbops/client.go new file mode 100644 index 00000000..abe3125d --- /dev/null +++ b/harness/dbops/client.go @@ -0,0 +1,482 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the Harness NextGen Software Delivery Platform API Reference API v1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + ApiKey string + AccountId string + + // API Services + + DatabaseInstanceApi *DatabaseInstanceApiService + + DatabaseSchemaApi *DatabaseSchemaApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.ApiKey = cfg.ApiKey + c.AccountId = cfg.AccountId + + // API Services + c.DatabaseInstanceApi = (*DatabaseInstanceApiService)(&c.common) + c.DatabaseSchemaApi = (*DatabaseSchemaApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} diff --git a/harness/dbops/client_utils.go b/harness/dbops/client_utils.go new file mode 100644 index 00000000..e80acaec --- /dev/null +++ b/harness/dbops/client_utils.go @@ -0,0 +1,10 @@ +package dbops + +import ( + "context" +) + +func (c *APIClient) WithAuthContext(ctx context.Context) (*APIClient, context.Context) { + authCtx := context.WithValue(ctx, ContextAPIKey, APIKey{Key: c.ApiKey}) + return c, authCtx +} diff --git a/harness/dbops/configuration.go b/harness/dbops/configuration.go new file mode 100644 index 00000000..c62dd9f0 --- /dev/null +++ b/harness/dbops/configuration.go @@ -0,0 +1,79 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +import ( + "net/http" + + "github.com/harness/harness-go-sdk/harness/helpers" + "github.com/harness/harness-go-sdk/harness/utils" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +type Configuration struct { + AccountId string `json:"accountId,omitempty"` + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + HTTPClient *http.Client + ApiKey string `json:"apiKey,omitempty"` +} + +func NewConfiguration() *Configuration { + cfg := &Configuration{ + AccountId: helpers.EnvVars.AccountId.Get(), + ApiKey: helpers.EnvVars.PlatformApiKey.Get(), + BasePath: helpers.EnvVars.Endpoint.GetWithDefault(utils.BaseUrl), + DefaultHeader: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", + } + return cfg +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} diff --git a/harness/dbops/docs/Changelog.md b/harness/dbops/docs/Changelog.md new file mode 100644 index 00000000..1f493841 --- /dev/null +++ b/harness/dbops/docs/Changelog.md @@ -0,0 +1,11 @@ +# Changelog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Connector** | **string** | identifier of the harness git connector | [default to null] +**Location** | **string** | path to the change log file | [default to null] +**Repo** | **string** | repo name of the git based connector when ConnectionType is Account | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/Command.md b/harness/dbops/docs/Command.md new file mode 100644 index 00000000..95359a60 --- /dev/null +++ b/harness/dbops/docs/Command.md @@ -0,0 +1,8 @@ +# Command + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/CommandExecutionStatus.md b/harness/dbops/docs/CommandExecutionStatus.md new file mode 100644 index 00000000..cd1e945e --- /dev/null +++ b/harness/dbops/docs/CommandExecutionStatus.md @@ -0,0 +1,8 @@ +# CommandExecutionStatus + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/DatabaseInstanceApi.md b/harness/dbops/docs/DatabaseInstanceApi.md new file mode 100644 index 00000000..e2f9c55b --- /dev/null +++ b/harness/dbops/docs/DatabaseInstanceApi.md @@ -0,0 +1,182 @@ +# nextgen{{classname}} + +All URIs are relative to */* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**V1CreateProjDbSchemaInstance**](DatabaseInstanceApi.md#V1CreateProjDbSchemaInstance) | **Post** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance | Create a database instance +[**V1DeleteProjDbSchemaInstance**](DatabaseInstanceApi.md#V1DeleteProjDbSchemaInstance) | **Delete** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance} | Delete a database instance +[**V1GetProjDbSchemaInstance**](DatabaseInstanceApi.md#V1GetProjDbSchemaInstance) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance} | Get a database instance +[**V1ListProjDbSchemaInstance**](DatabaseInstanceApi.md#V1ListProjDbSchemaInstance) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance | List database instances + +# **V1CreateProjDbSchemaInstance** +> DbInstanceOut V1CreateProjDbSchemaInstance(ctx, body, org, project, dbschema, optional) +Create a database instance + +Create a database instance + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **body** | [**DbInstanceIn**](DbInstanceIn.md)| | + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **optional** | ***DatabaseInstanceApiV1CreateProjDbSchemaInstanceOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseInstanceApiV1CreateProjDbSchemaInstanceOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + **harnessAccount** | **optional.**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**DbInstanceOut**](DBInstanceOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1DeleteProjDbSchemaInstance** +> V1DeleteProjDbSchemaInstance(ctx, org, project, dbschema, dbinstance, optional) +Delete a database instance + +Delete a database instance + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **dbinstance** | **string**| database instance unique id | + **optional** | ***DatabaseInstanceApiV1DeleteProjDbSchemaInstanceOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseInstanceApiV1DeleteProjDbSchemaInstanceOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + **harnessAccount** | **optional.String**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1GetProjDbSchemaInstance** +> DbInstanceOut V1GetProjDbSchemaInstance(ctx, org, project, dbschema, dbinstance, optional) +Get a database instance + +Retrieves the specified database instance + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **dbinstance** | **string**| database instance unique id | + **optional** | ***DatabaseInstanceApiV1GetProjDbSchemaInstanceOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseInstanceApiV1GetProjDbSchemaInstanceOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + **harnessAccount** | **optional.String**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**DbInstanceOut**](DBInstanceOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1ListProjDbSchemaInstance** +> []DbInstanceOut V1ListProjDbSchemaInstance(ctx, org, project, dbschema, optional) +List database instances + +Retrieves the specified database instances of the database schema + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **optional** | ***DatabaseInstanceApiV1ListProjDbSchemaInstanceOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseInstanceApiV1ListProjDbSchemaInstanceOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + **harnessAccount** | **optional.String**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + **page** | **optional.Int64**| Pagination page number strategy: Specify the page number within the paginated collection related to the number of items on each page. | [default to 0] + **limit** | **optional.Int32**| Pagination: Number of items to return. | [default to 10] + **searchTerm** | **optional.String**| This would be used to filter resources having attributes matching the search term. | + **sort** | **optional.String**| Parameter on the basis of which sorting is done. | + **order** | **optional.String**| Order on the basis of which sorting is done. | + +### Return type + +[**[]DbInstanceOut**](DBInstanceOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/DatabaseSchemaApi.md b/harness/dbops/docs/DatabaseSchemaApi.md new file mode 100644 index 00000000..a6154484 --- /dev/null +++ b/harness/dbops/docs/DatabaseSchemaApi.md @@ -0,0 +1,262 @@ +# nextgen{{classname}} + +All URIs are relative to */* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**V1CreateProjDbSchema**](DatabaseSchemaApi.md#V1CreateProjDbSchema) | **Post** /v1/orgs/{org}/projects/{project}/dbschema | Create a database schema +[**V1DeleteProjDbSchema**](DatabaseSchemaApi.md#V1DeleteProjDbSchema) | **Delete** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema} | Delete a database schema +[**V1GetProjDbSchema**](DatabaseSchemaApi.md#V1GetProjDbSchema) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema} | Get a database schema +[**V1ListProjDbSchema**](DatabaseSchemaApi.md#V1ListProjDbSchema) | **Get** /v1/orgs/{org}/projects/{project}/dbschema | List database schemas +[**V1UpdateProjDbSchema**](DatabaseSchemaApi.md#V1UpdateProjDbSchema) | **Put** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema} | Update a database schema +[**V1UpdateProjDbSchemaInstance**](DatabaseSchemaApi.md#V1UpdateProjDbSchemaInstance) | **Put** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance} | Update a database instance + +# **V1CreateProjDbSchema** +> DbSchemaOut V1CreateProjDbSchema(ctx, body, org, project, optional) +Create a database schema + +Create a database schema + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **body** | [**DbSchemaIn**](DbSchemaIn.md)| | + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **optional** | ***DatabaseSchemaApiV1CreateProjDbSchemaOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseSchemaApiV1CreateProjDbSchemaOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + **harnessAccount** | **optional.**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**DbSchemaOut**](DBSchemaOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1DeleteProjDbSchema** +> V1DeleteProjDbSchema(ctx, org, project, dbschema, optional) +Delete a database schema + +Delete a database schema + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **optional** | ***DatabaseSchemaApiV1DeleteProjDbSchemaOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseSchemaApiV1DeleteProjDbSchemaOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + **harnessAccount** | **optional.String**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1GetProjDbSchema** +> DbSchemaOut V1GetProjDbSchema(ctx, org, project, dbschema, optional) +Get a database schema + +Retrieves the specified database schema + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **optional** | ***DatabaseSchemaApiV1GetProjDbSchemaOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseSchemaApiV1GetProjDbSchemaOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + **harnessAccount** | **optional.String**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**DbSchemaOut**](DBSchemaOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1ListProjDbSchema** +> []DbSchemaOut V1ListProjDbSchema(ctx, org, project, optional) +List database schemas + +List database Schemas + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **optional** | ***DatabaseSchemaApiV1ListProjDbSchemaOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseSchemaApiV1ListProjDbSchemaOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **harnessAccount** | **optional.String**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + **page** | **optional.Int64**| Pagination page number strategy: Specify the page number within the paginated collection related to the number of items on each page. | [default to 0] + **limit** | **optional.Int32**| Pagination: Number of items to return. | [default to 10] + **searchTerm** | **optional.String**| This would be used to filter resources having attributes matching the search term. | + **sort** | **optional.String**| Parameter on the basis of which sorting is done. | + **order** | **optional.String**| Order on the basis of which sorting is done. | + +### Return type + +[**[]DbSchemaOut**](DBSchemaOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1UpdateProjDbSchema** +> DbSchemaOut V1UpdateProjDbSchema(ctx, body, org, project, dbschema, optional) +Update a database schema + +Update a database schema + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **body** | [**interface{}**](interface{}.md)| Database schema update request | + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **optional** | ***DatabaseSchemaApiV1UpdateProjDbSchemaOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseSchemaApiV1UpdateProjDbSchemaOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + **harnessAccount** | **optional.**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**DbSchemaOut**](DBSchemaOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1UpdateProjDbSchemaInstance** +> DbInstanceOut V1UpdateProjDbSchemaInstance(ctx, body, org, project, dbschema, dbinstance, optional) +Update a database instance + +Update a database instance + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **body** | [**interface{}**](interface{}.md)| Database instance update request | + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **dbinstance** | **string**| database instance unique id | + **optional** | ***DatabaseSchemaApiV1UpdateProjDbSchemaInstanceOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a DatabaseSchemaApiV1UpdateProjDbSchemaInstanceOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + + **harnessAccount** | **optional.**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**DbInstanceOut**](DBInstanceOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/DbInstanceIn.md b/harness/dbops/docs/DbInstanceIn.md new file mode 100644 index 00000000..fc88576e --- /dev/null +++ b/harness/dbops/docs/DbInstanceIn.md @@ -0,0 +1,14 @@ +# DbInstanceIn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Branch** | **string** | branch where the instance is stored | [default to null] +**Connector** | **string** | DB Connector | [default to null] +**Context** | **string** | Liquibase context | [optional] [default to null] +**Identifier** | **string** | identifier of the database instance | [default to null] +**Name** | **string** | name of the database instance | [optional] [default to null] +**Tags** | **map[string]string** | tags attached to the database instance | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/DbInstanceOut.md b/harness/dbops/docs/DbInstanceOut.md new file mode 100644 index 00000000..68106eca --- /dev/null +++ b/harness/dbops/docs/DbInstanceOut.md @@ -0,0 +1,17 @@ +# DbInstanceOut + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Branch** | **string** | branch where the instance is stored | [default to null] +**Connector** | **string** | DB Connector | [default to null] +**Context** | **string** | Liquibase context | [optional] [default to null] +**Created** | **int64** | epoch seconds when the database instance was created | [default to null] +**Identifier** | **string** | identifier of the database instance | [default to null] +**LastAppliedTag** | **string** | Most recent tag applied to the database | [optional] [default to null] +**Name** | **string** | name of the database instance | [default to null] +**Tags** | **map[string]string** | tags attached to the database instance | [optional] [default to null] +**Updated** | **int64** | epoch seconds when the database instance was last updated | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/DbSchemaIn.md b/harness/dbops/docs/DbSchemaIn.md new file mode 100644 index 00000000..d7b6ed59 --- /dev/null +++ b/harness/dbops/docs/DbSchemaIn.md @@ -0,0 +1,13 @@ +# DbSchemaIn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Changelog** | [***Changelog**](Changelog.md) | | [default to null] +**Identifier** | **string** | identifier of the database schema | [default to null] +**Name** | **string** | name of the database schema | [default to null] +**Service** | **string** | harness service corresponding to database schema | [optional] [default to null] +**Tags** | **map[string]string** | tags attached to the database schema | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/DbSchemaOut.md b/harness/dbops/docs/DbSchemaOut.md new file mode 100644 index 00000000..f71739e3 --- /dev/null +++ b/harness/dbops/docs/DbSchemaOut.md @@ -0,0 +1,16 @@ +# DbSchemaOut + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Changelog** | [***Changelog**](Changelog.md) | | [default to null] +**Created** | **int64** | epoch seconds when the database schema was created | [default to null] +**Identifier** | **string** | identifier of the database schema | [default to null] +**InstanceCount** | **int64** | number of database instances corresponding to database schema | [default to null] +**Name** | **string** | name of the database schema | [default to null] +**Service** | **string** | harness service corresponding to database schema | [optional] [default to null] +**Tags** | **map[string]string** | tags attached to the database schema | [optional] [default to null] +**Updated** | **int64** | epoch seconds when the database schema was last updated | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/InlineResponse200.md b/harness/dbops/docs/InlineResponse200.md new file mode 100644 index 00000000..7a0a4ce4 --- /dev/null +++ b/harness/dbops/docs/InlineResponse200.md @@ -0,0 +1,12 @@ +# InlineResponse200 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Image** | **string** | | [optional] [default to null] +**Instance** | [***DbInstanceOut**](DBInstanceOut.md) | | [optional] [default to null] +**Schema** | [***DbSchemaOut**](DBSchemaOut.md) | | [optional] [default to null] +**Settings** | **map[string]string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/LogIngestApi.md b/harness/dbops/docs/LogIngestApi.md new file mode 100644 index 00000000..63819351 --- /dev/null +++ b/harness/dbops/docs/LogIngestApi.md @@ -0,0 +1,97 @@ +# nextgen{{classname}} + +All URIs are relative to */* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**V1GetDbinstanceLog**](LogIngestApi.md#V1GetDbinstanceLog) | **Get** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}/logs/{log} | +[**V1IngestLogs**](LogIngestApi.md#V1IngestLogs) | **Post** /v1/orgs/{org}/projects/{project}/dbschema/{dbschema}/instance/{dbinstance}/logs | Ingest database migration logs + +# **V1GetDbinstanceLog** +> ParsedLogOut V1GetDbinstanceLog(ctx, org, project, dbschema, dbinstance, log, optional) + + +Retrieves the specified log event + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **dbinstance** | **string**| database instance unique id | + **log** | **string**| | + **optional** | ***LogIngestApiV1GetDbinstanceLogOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a LogIngestApiV1GetDbinstanceLogOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + + **harnessAccount** | **optional.String**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**ParsedLogOut**](ParsedLogOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **V1IngestLogs** +> ParsedLogOut V1IngestLogs(ctx, body, org, project, dbschema, dbinstance, optional) +Ingest database migration logs + +Ingest database migration logs to update the state of the database + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **body** | [**string**](string.md)| Request body for log ingestion | + **org** | **string**| Organization identifier | + **project** | **string**| Project identifier | + **dbschema** | **string**| Identifier of the database schema | + **dbinstance** | **string**| database instance unique id | + **optional** | ***LogIngestApiV1IngestLogsOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a LogIngestApiV1IngestLogsOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + + **harnessAccount** | **optional.**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**ParsedLogOut**](ParsedLogOut.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: text/plain + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/ModelError.md b/harness/dbops/docs/ModelError.md new file mode 100644 index 00000000..e76aee11 --- /dev/null +++ b/harness/dbops/docs/ModelError.md @@ -0,0 +1,9 @@ +# ModelError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **string** | error message detail | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/ParsedLogOut.md b/harness/dbops/docs/ParsedLogOut.md new file mode 100644 index 00000000..4ea75d6e --- /dev/null +++ b/harness/dbops/docs/ParsedLogOut.md @@ -0,0 +1,11 @@ +# ParsedLogOut + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Command** | **string** | | [default to null] +**Id** | **string** | identifier of the logIngest entity | [default to null] +**Success** | **bool** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/harness/dbops/docs/PipelineStepApi.md b/harness/dbops/docs/PipelineStepApi.md new file mode 100644 index 00000000..5867cd5e --- /dev/null +++ b/harness/dbops/docs/PipelineStepApi.md @@ -0,0 +1,80 @@ +# nextgen{{classname}} + +All URIs are relative to */* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ConsumeV1StepPluginResponse**](PipelineStepApi.md#ConsumeV1StepPluginResponse) | **Post** /v1/step/plugin-response | ConsumePluginResponse +[**CreateV1StepPluginInputs**](PipelineStepApi.md#CreateV1StepPluginInputs) | **Post** /v1/step/plugin-inputs | CreatePluginInputs + +# **ConsumeV1StepPluginResponse** +> ConsumeV1StepPluginResponse(ctx, optional) +ConsumePluginResponse + +Consume Plugin Execution Response + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***PipelineStepApiConsumeV1StepPluginResponseOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a PipelineStepApiConsumeV1StepPluginResponseOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**optional.Interface of interface{}**](interface{}.md)| | + **harnessAccount** | **optional.**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateV1StepPluginInputs** +> InlineResponse200 CreateV1StepPluginInputs(ctx, body, optional) +CreatePluginInputs + +Create Plugin Inputs using Step Inputs + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **body** | [**interface{}**](interface{}.md)| Inputs to create plugin inputs | + **optional** | ***PipelineStepApiCreateV1StepPluginInputsOpts** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a pointer to a PipelineStepApiCreateV1StepPluginInputsOpts struct +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **harnessAccount** | **optional.**| Identifier field of the account the resource is scoped to. This is required for Authorization methods other than the x-api-key header. If you are using the x-api-key header, this can be skipped. | + +### Return type + +[**InlineResponse200**](inline_response_200.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/harness/dbops/git_push.sh b/harness/dbops/git_push.sh new file mode 100644 index 00000000..ae01b182 --- /dev/null +++ b/harness/dbops/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/harness/dbops/model_changelog.go b/harness/dbops/model_changelog.go new file mode 100644 index 00000000..db187e3f --- /dev/null +++ b/harness/dbops/model_changelog.go @@ -0,0 +1,20 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +// location of the changelog file containing schema changes in a git repository +type Changelog struct { + // identifier of the harness git connector + Connector string `json:"connector"` + // path to the change log file + Location string `json:"location"` + // repo name of the git based connector when ConnectionType is Account + Repo string `json:"repo,omitempty"` +} diff --git a/harness/dbops/model_command.go b/harness/dbops/model_command.go new file mode 100644 index 00000000..07db4047 --- /dev/null +++ b/harness/dbops/model_command.go @@ -0,0 +1,22 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +// Command : Type of the plugin command to run +type Command string + +// List of Command +const ( + UPDATE_Command Command = "Update" + VALIDATE_Command Command = "Validate" + HISTORY_Command Command = "History" + TAG_Command Command = "Tag" + ROLLBACK_Command Command = "Rollback" +) diff --git a/harness/dbops/model_command_execution_status.go b/harness/dbops/model_command_execution_status.go new file mode 100644 index 00000000..cb266bae --- /dev/null +++ b/harness/dbops/model_command_execution_status.go @@ -0,0 +1,19 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +type CommandExecutionStatus string + +// List of CommandExecutionStatus +const ( + IN_PROGRESS_CommandExecutionStatus CommandExecutionStatus = "IN_PROGRESS" + SUCCESS_CommandExecutionStatus CommandExecutionStatus = "SUCCESS" + FAILURE_CommandExecutionStatus CommandExecutionStatus = "FAILURE" +) diff --git a/harness/dbops/model_db_instance_in.go b/harness/dbops/model_db_instance_in.go new file mode 100644 index 00000000..14cefb65 --- /dev/null +++ b/harness/dbops/model_db_instance_in.go @@ -0,0 +1,26 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +// Database Instance Request +type DbInstanceIn struct { + // branch where the instance is stored + Branch string `json:"branch"` + // DB Connector + Connector string `json:"connector"` + // Liquibase context + Context string `json:"context,omitempty"` + // identifier of the database instance + Identifier string `json:"identifier"` + // name of the database instance + Name string `json:"name,omitempty"` + // tags attached to the database instance + Tags map[string]string `json:"tags,omitempty"` +} diff --git a/harness/dbops/model_db_instance_out.go b/harness/dbops/model_db_instance_out.go new file mode 100644 index 00000000..fe80c93e --- /dev/null +++ b/harness/dbops/model_db_instance_out.go @@ -0,0 +1,32 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +// Database Instance Response +type DbInstanceOut struct { + // branch where the instance is stored + Branch string `json:"branch"` + // DB Connector + Connector string `json:"connector"` + // Liquibase context + Context string `json:"context,omitempty"` + // epoch seconds when the database instance was created + Created int64 `json:"created"` + // identifier of the database instance + Identifier string `json:"identifier"` + // Most recent tag applied to the database + LastAppliedTag string `json:"lastAppliedTag,omitempty"` + // name of the database instance + Name string `json:"name"` + // tags attached to the database instance + Tags map[string]string `json:"tags,omitempty"` + // epoch seconds when the database instance was last updated + Updated int64 `json:"updated,omitempty"` +} diff --git a/harness/dbops/model_db_schema_in.go b/harness/dbops/model_db_schema_in.go new file mode 100644 index 00000000..701de514 --- /dev/null +++ b/harness/dbops/model_db_schema_in.go @@ -0,0 +1,23 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +// Database Schema Request +type DbSchemaIn struct { + Changelog *Changelog `json:"changelog"` + // identifier of the database schema + Identifier string `json:"identifier"` + // name of the database schema + Name string `json:"name"` + // harness service corresponding to database schema + Service string `json:"service,omitempty"` + // tags attached to the database schema + Tags map[string]string `json:"tags,omitempty"` +} diff --git a/harness/dbops/model_db_schema_out.go b/harness/dbops/model_db_schema_out.go new file mode 100644 index 00000000..54b08ebd --- /dev/null +++ b/harness/dbops/model_db_schema_out.go @@ -0,0 +1,29 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +// Database Schema Response +type DbSchemaOut struct { + Changelog *Changelog `json:"changelog"` + // epoch seconds when the database schema was created + Created int64 `json:"created"` + // identifier of the database schema + Identifier string `json:"identifier"` + // number of database instances corresponding to database schema + InstanceCount int64 `json:"instanceCount"` + // name of the database schema + Name string `json:"name"` + // harness service corresponding to database schema + Service string `json:"service,omitempty"` + // tags attached to the database schema + Tags map[string]string `json:"tags,omitempty"` + // epoch seconds when the database schema was last updated + Updated int64 `json:"updated,omitempty"` +} diff --git a/harness/dbops/model_error.go b/harness/dbops/model_error.go new file mode 100644 index 00000000..8392956a --- /dev/null +++ b/harness/dbops/model_error.go @@ -0,0 +1,16 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +// Error Response +type ModelError struct { + // error message detail + Message string `json:"message"` +} diff --git a/harness/dbops/model_inline_response_200.go b/harness/dbops/model_inline_response_200.go new file mode 100644 index 00000000..57f345b2 --- /dev/null +++ b/harness/dbops/model_inline_response_200.go @@ -0,0 +1,17 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +type InlineResponse200 struct { + Image string `json:"image,omitempty"` + Instance *DbInstanceOut `json:"instance,omitempty"` + Schema *DbSchemaOut `json:"schema,omitempty"` + Settings map[string]string `json:"settings,omitempty"` +} diff --git a/harness/dbops/model_parsed_log_out.go b/harness/dbops/model_parsed_log_out.go new file mode 100644 index 00000000..f871a691 --- /dev/null +++ b/harness/dbops/model_parsed_log_out.go @@ -0,0 +1,17 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +type ParsedLogOut struct { + Command string `json:"command"` + // identifier of the logIngest entity + Id string `json:"id"` + Success bool `json:"success"` +} diff --git a/harness/dbops/response.go b/harness/dbops/response.go new file mode 100644 index 00000000..3f91e6d1 --- /dev/null +++ b/harness/dbops/response.go @@ -0,0 +1,43 @@ +/* + * Harness NextGen Software Delivery Platform API Reference + * + * This is the Open Api Spec 3 for the DB Service + * + * API version: 1.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package dbops + +import ( + "net/http" +) + +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +}