diff --git a/Justfile b/Justfile index d3b10879..4e1e74e7 100644 --- a/Justfile +++ b/Justfile @@ -2,22 +2,24 @@ TMP_DIR := "tmp" CONFIG_API_CLIENT_DIR := "pkg/config-api-client" CONFIG_API_PROVIDER_DIR := "pkg/config-api-provider" OPENAPI_SPEC := "pkg/config-api-client/api" +SOURCE_OPEN_API_SPEC_FILE := ".openapi.source.yaml" retrieve-config-api-openapi-spec: rm -rf {{ TMP_DIR }} git clone git@github.com:aruba-uxi/configuration-api.git --depth=1 {{ TMP_DIR }} mkdir -p {{ OPENAPI_SPEC }} - cp {{ TMP_DIR }}/oas/openapi.yaml {{ OPENAPI_SPEC }}/openapi.yaml + cp {{ TMP_DIR }}/oas/openapi.yaml {{ OPENAPI_SPEC }}/{{ SOURCE_OPEN_API_SPEC_FILE }} rm -rf {{ TMP_DIR }} generate-config-api-client: retrieve-config-api-openapi-spec docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \ - --input-spec /local/{{ OPENAPI_SPEC }}/openapi.yaml \ + --input-spec /local/{{ OPENAPI_SPEC }}/{{ SOURCE_OPEN_API_SPEC_FILE }} \ --generator-name go \ --output /local/{{ CONFIG_API_CLIENT_DIR }} \ --package-name config_api_client \ --git-user-id aruba-uxi \ --git-repo-id configuration-api-terraform-provider/{{ CONFIG_API_CLIENT_DIR }} \ + --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=configuration cd {{ CONFIG_API_CLIENT_DIR }} && go mod tidy just fmt-client diff --git a/pkg/config-api-client/.openapi-generator/FILES b/pkg/config-api-client/.openapi-generator/FILES index c5ad9506..55224e73 100644 --- a/pkg/config-api-client/.openapi-generator/FILES +++ b/pkg/config-api-client/.openapi-generator/FILES @@ -1,18 +1,25 @@ -.gitignore README.md api/openapi.yaml -api_health.go +api_configuration.go client.go configuration.go +docs/ConfigurationAPI.md +docs/ErrorDetail.md docs/ErrorResponse.md -docs/HealthAPI.md +docs/GroupsPostRequest.md +docs/GroupsPostResponse.md docs/LivenessResponse.md +docs/ReadinessErrorResponse.md docs/ReadinessResponse.md docs/StatusResponse.md go.mod go.sum +model_error_detail.go model_error_response.go +model_groups_post_request.go +model_groups_post_response.go model_liveness_response.go +model_readiness_error_response.go model_readiness_response.go model_status_response.go response.go diff --git a/pkg/config-api-client/README.md b/pkg/config-api-client/README.md index b02f5658..dc7bc2ca 100644 --- a/pkg/config-api-client/README.md +++ b/pkg/config-api-client/README.md @@ -1,14 +1,15 @@ # Go API client for config_api_client -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.0.0 +- API version: 1.2.0 - Package version: 1.0.0 - Generator version: 7.8.0-SNAPSHOT - Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [http://we.dont.care.yet.com/contact](http://we.dont.care.yet.com/contact) ## Installation @@ -74,26 +75,42 @@ ctx = context.WithValue(context.Background(), config_api_client.ContextOperation ## Documentation for API Endpoints -All URIs are relative to *http://localhost* +All URIs are relative to *https://api.capenetworks.com* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*HealthAPI* | [**GetLivezHealthLivezGet**](docs/HealthAPI.md#getlivezhealthlivezget) | **Get** /health/livez | Live health check -*HealthAPI* | [**GetReadyzHealthReadyzGet**](docs/HealthAPI.md#getreadyzhealthreadyzget) | **Get** /health/readyz | Ready health check -*HealthAPI* | [**GetStatusHealthStatusGet**](docs/HealthAPI.md#getstatushealthstatusget) | **Get** /health/status | Service stats endpoint +*ConfigurationAPI* | [**GetLivezHealthLivezGet**](docs/ConfigurationAPI.md#getlivezhealthlivezget) | **Get** /health/livez | Live health check +*ConfigurationAPI* | [**GetReadyzHealthReadyzGet**](docs/ConfigurationAPI.md#getreadyzhealthreadyzget) | **Get** /health/readyz | Ready health check +*ConfigurationAPI* | [**GetStatusHealthStatusGet**](docs/ConfigurationAPI.md#getstatushealthstatusget) | **Get** /health/status | Service stats endpoint +*ConfigurationAPI* | [**GroupsPostConfigurationAppV1GroupsPost**](docs/ConfigurationAPI.md#groupspostconfigurationappv1groupspost) | **Post** /configuration/app/v1/groups | Groups Post ## Documentation For Models + - [ErrorDetail](docs/ErrorDetail.md) - [ErrorResponse](docs/ErrorResponse.md) + - [GroupsPostRequest](docs/GroupsPostRequest.md) + - [GroupsPostResponse](docs/GroupsPostResponse.md) - [LivenessResponse](docs/LivenessResponse.md) + - [ReadinessErrorResponse](docs/ReadinessErrorResponse.md) - [ReadinessResponse](docs/ReadinessResponse.md) - [StatusResponse](docs/StatusResponse.md) ## Documentation For Authorization -Endpoints do not require authorization. + +Authentication schemes defined for the API: +### HTTPBearer + +- **Type**: HTTP Bearer token authentication + +Example + +```go +auth := context.WithValue(context.Background(), config_api_client.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` ## Documentation for Utility Methods @@ -114,5 +131,5 @@ Each of these functions takes a value of the given basic type and returns a poin ## Author - +support@capenetworks.com diff --git a/pkg/config-api-client/api/.openapi.source.yaml b/pkg/config-api-client/api/.openapi.source.yaml new file mode 100644 index 00000000..21a395a1 --- /dev/null +++ b/pkg/config-api-client/api/.openapi.source.yaml @@ -0,0 +1,229 @@ +openapi: 3.0.3 +info: + title: Configuration Api + description: Nice description goes here + termsOfService: http://we.dont.care.yet.com/term-of-service + contact: + name: We need a person + url: http://we.dont.care.yet.com/contact + email: support@capenetworks.com + license: + name: No idea, but we need something + version: 1.2.0 +servers: + - url: https://api.capenetworks.com + - url: https://api.staging.capedev.io +paths: + /health/livez: + get: + operationId: get_livez_health_livez_get + summary: Live health check + description: Check the health of the service. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/LivenessResponse' + deprecated: true + tags: + - health + /health/readyz: + get: + operationId: get_readyz_health_readyz_get + summary: Ready health check + description: Check if the service is ready to process requests. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ReadinessResponse' + '503': + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/ReadinessErrorResponse' + deprecated: true + tags: + - health + /health/status: + get: + operationId: get_status_health_status_get + summary: Service stats endpoint + description: Check basic service details. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/StatusResponse' + deprecated: true + tags: + - health + /configuration/app/v1/groups: + post: + operationId: groups_post_configuration_app_v1_groups_post + summary: Groups Post + description: >- + Create a new group with the group identified in `parent_uid` as its parent + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/GroupsPostRequest' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/GroupsPostResponse' + 4XX: + description: Client Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + 5XX: + description: Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + security: + - HTTPBearer: [] + tags: + - api + - configuration + - v1 + - groups +components: + schemas: + ErrorDetail: + type: object + properties: + message: + type: string + title: Message + required: + - message + title: ErrorDetail + ErrorResponse: + type: object + properties: + detail: + type: array + items: + $ref: '#/components/schemas/ErrorDetail' + title: Detail + required: + - detail + title: ErrorResponse + GroupsPostRequest: + type: object + properties: + parent_uid: + type: string + title: Parent Uid + name: + type: string + title: Name + required: + - parent_uid + - name + title: GroupsPostRequest + GroupsPostResponse: + type: object + properties: + parent_uid: + type: string + title: Parent Uid + name: + type: string + title: Name + uid: + type: string + title: Uid + path: + type: string + title: Path + required: + - parent_uid + - name + - uid + - path + title: GroupsPostResponse + LivenessResponse: + type: object + properties: + status: + type: string + enum: + - OK + title: Status + required: + - status + title: LivenessResponse + ReadinessErrorResponse: + type: object + properties: + data: + type: object + additionalProperties: + type: string + title: Data + status: + type: string + enum: + - ERROR + title: Status + required: + - data + - status + title: ReadinessErrorResponse + ReadinessResponse: + type: object + properties: + data: + type: object + additionalProperties: + type: string + title: Data + status: + type: string + enum: + - OK + title: Status + required: + - data + - status + title: ReadinessResponse + StatusResponse: + type: object + properties: + name: + type: string + title: Name + version: + type: string + title: Version + required: + - name + - version + title: StatusResponse + securitySchemes: + HTTPBearer: + type: http + scheme: bearer +tags: + - name: api + - name: v1 + - name: configuration + - name: groups + - name: health diff --git a/pkg/config-api-client/api/openapi.yaml b/pkg/config-api-client/api/openapi.yaml index 0a1776f3..189dec0d 100644 --- a/pkg/config-api-client/api/openapi.yaml +++ b/pkg/config-api-client/api/openapi.yaml @@ -1,12 +1,28 @@ openapi: 3.0.3 info: - title: FastAPI - version: 1.0.0 + contact: + email: support@capenetworks.com + name: We need a person + url: http://we.dont.care.yet.com/contact + description: Nice description goes here + license: + name: "No idea, but we need something" + termsOfService: http://we.dont.care.yet.com/term-of-service + title: Configuration Api + version: 1.2.0 servers: -- url: / +- url: https://api.capenetworks.com +- url: https://api.staging.capedev.io +tags: +- name: api +- name: v1 +- name: configuration +- name: groups +- name: health paths: /health/livez: get: + deprecated: true description: Check the health of the service. operationId: get_livez_health_livez_get responses: @@ -18,9 +34,10 @@ paths: description: Successful Response summary: Live health check tags: - - health + - configuration /health/readyz: get: + deprecated: true description: Check if the service is ready to process requests. operationId: get_readyz_health_readyz_get responses: @@ -34,13 +51,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/ReadinessErrorResponse' description: Service Unavailable summary: Ready health check tags: - - health + - configuration /health/status: get: + deprecated: true description: Check basic service details. operationId: get_status_health_status_get responses: @@ -52,10 +70,126 @@ paths: description: Successful Response summary: Service stats endpoint tags: - - health + - configuration + /configuration/app/v1/groups: + post: + description: Create a new group with the group identified in `parent_uid` as + its parent + operationId: groups_post_configuration_app_v1_groups_post + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GroupsPostRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GroupsPostResponse' + description: Successful Response + "4XX": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Client Error + "5XX": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Server Error + security: + - HTTPBearer: [] + summary: Groups Post + tags: + - configuration components: schemas: + ErrorDetail: + example: + message: message + properties: + message: + title: Message + type: string + required: + - message + title: ErrorDetail + type: object ErrorResponse: + example: + detail: + - message: message + - message: message + properties: + detail: + items: + $ref: '#/components/schemas/ErrorDetail' + title: Detail + type: array + required: + - detail + title: ErrorResponse + type: object + GroupsPostRequest: + example: + parent_uid: parent_uid + name: name + properties: + parent_uid: + title: Parent Uid + type: string + name: + title: Name + type: string + required: + - name + - parent_uid + title: GroupsPostRequest + type: object + GroupsPostResponse: + example: + uid: uid + path: path + parent_uid: parent_uid + name: name + properties: + parent_uid: + title: Parent Uid + type: string + name: + title: Name + type: string + uid: + title: Uid + type: string + path: + title: Path + type: string + required: + - name + - parent_uid + - path + - uid + title: GroupsPostResponse + type: object + LivenessResponse: + example: + status: OK + properties: + status: + enum: + - OK + title: Status + type: string + required: + - status + title: LivenessResponse + type: object + ReadinessErrorResponse: example: data: key: data @@ -74,20 +208,7 @@ components: required: - data - status - title: ErrorResponse - type: object - LivenessResponse: - example: - status: OK - properties: - status: - enum: - - OK - title: Status - type: string - required: - - status - title: LivenessResponse + title: ReadinessErrorResponse type: object ReadinessResponse: example: @@ -126,3 +247,7 @@ components: - version title: StatusResponse type: object + securitySchemes: + HTTPBearer: + scheme: bearer + type: http diff --git a/pkg/config-api-client/api_health.go b/pkg/config-api-client/api_configuration.go similarity index 60% rename from pkg/config-api-client/api_health.go rename to pkg/config-api-client/api_configuration.go index c2f30a3f..7c2bd4c2 100644 --- a/pkg/config-api-client/api_health.go +++ b/pkg/config-api-client/api_configuration.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -18,12 +19,12 @@ import ( "net/url" ) -// HealthAPIService HealthAPI service -type HealthAPIService service +// ConfigurationAPIService ConfigurationAPI service +type ConfigurationAPIService service type ApiGetLivezHealthLivezGetRequest struct { ctx context.Context - ApiService *HealthAPIService + ApiService *ConfigurationAPIService } func (r ApiGetLivezHealthLivezGetRequest) Execute() (*LivenessResponse, *http.Response, error) { @@ -37,8 +38,10 @@ Check the health of the service. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiGetLivezHealthLivezGetRequest + +Deprecated */ -func (a *HealthAPIService) GetLivezHealthLivezGet(ctx context.Context) ApiGetLivezHealthLivezGetRequest { +func (a *ConfigurationAPIService) GetLivezHealthLivezGet(ctx context.Context) ApiGetLivezHealthLivezGetRequest { return ApiGetLivezHealthLivezGetRequest{ ApiService: a, ctx: ctx, @@ -48,7 +51,9 @@ func (a *HealthAPIService) GetLivezHealthLivezGet(ctx context.Context) ApiGetLiv // Execute executes the request // // @return LivenessResponse -func (a *HealthAPIService) GetLivezHealthLivezGetExecute(r ApiGetLivezHealthLivezGetRequest) (*LivenessResponse, *http.Response, error) { +// +// Deprecated +func (a *ConfigurationAPIService) GetLivezHealthLivezGetExecute(r ApiGetLivezHealthLivezGetRequest) (*LivenessResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -56,7 +61,7 @@ func (a *HealthAPIService) GetLivezHealthLivezGetExecute(r ApiGetLivezHealthLive localVarReturnValue *LivenessResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HealthAPIService.GetLivezHealthLivezGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GetLivezHealthLivezGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -123,7 +128,7 @@ func (a *HealthAPIService) GetLivezHealthLivezGetExecute(r ApiGetLivezHealthLive type ApiGetReadyzHealthReadyzGetRequest struct { ctx context.Context - ApiService *HealthAPIService + ApiService *ConfigurationAPIService } func (r ApiGetReadyzHealthReadyzGetRequest) Execute() (*ReadinessResponse, *http.Response, error) { @@ -137,8 +142,10 @@ Check if the service is ready to process requests. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiGetReadyzHealthReadyzGetRequest + +Deprecated */ -func (a *HealthAPIService) GetReadyzHealthReadyzGet(ctx context.Context) ApiGetReadyzHealthReadyzGetRequest { +func (a *ConfigurationAPIService) GetReadyzHealthReadyzGet(ctx context.Context) ApiGetReadyzHealthReadyzGetRequest { return ApiGetReadyzHealthReadyzGetRequest{ ApiService: a, ctx: ctx, @@ -148,7 +155,9 @@ func (a *HealthAPIService) GetReadyzHealthReadyzGet(ctx context.Context) ApiGetR // Execute executes the request // // @return ReadinessResponse -func (a *HealthAPIService) GetReadyzHealthReadyzGetExecute(r ApiGetReadyzHealthReadyzGetRequest) (*ReadinessResponse, *http.Response, error) { +// +// Deprecated +func (a *ConfigurationAPIService) GetReadyzHealthReadyzGetExecute(r ApiGetReadyzHealthReadyzGetRequest) (*ReadinessResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -156,7 +165,7 @@ func (a *HealthAPIService) GetReadyzHealthReadyzGetExecute(r ApiGetReadyzHealthR localVarReturnValue *ReadinessResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HealthAPIService.GetReadyzHealthReadyzGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GetReadyzHealthReadyzGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -207,7 +216,7 @@ func (a *HealthAPIService) GetReadyzHealthReadyzGetExecute(r ApiGetReadyzHealthR error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 503 { - var v ErrorResponse + var v ReadinessErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -233,7 +242,7 @@ func (a *HealthAPIService) GetReadyzHealthReadyzGetExecute(r ApiGetReadyzHealthR type ApiGetStatusHealthStatusGetRequest struct { ctx context.Context - ApiService *HealthAPIService + ApiService *ConfigurationAPIService } func (r ApiGetStatusHealthStatusGetRequest) Execute() (*StatusResponse, *http.Response, error) { @@ -247,8 +256,10 @@ Check basic service details. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiGetStatusHealthStatusGetRequest + +Deprecated */ -func (a *HealthAPIService) GetStatusHealthStatusGet(ctx context.Context) ApiGetStatusHealthStatusGetRequest { +func (a *ConfigurationAPIService) GetStatusHealthStatusGet(ctx context.Context) ApiGetStatusHealthStatusGetRequest { return ApiGetStatusHealthStatusGetRequest{ ApiService: a, ctx: ctx, @@ -258,7 +269,9 @@ func (a *HealthAPIService) GetStatusHealthStatusGet(ctx context.Context) ApiGetS // Execute executes the request // // @return StatusResponse -func (a *HealthAPIService) GetStatusHealthStatusGetExecute(r ApiGetStatusHealthStatusGetRequest) (*StatusResponse, *http.Response, error) { +// +// Deprecated +func (a *ConfigurationAPIService) GetStatusHealthStatusGetExecute(r ApiGetStatusHealthStatusGetRequest) (*StatusResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -266,7 +279,7 @@ func (a *HealthAPIService) GetStatusHealthStatusGetExecute(r ApiGetStatusHealthS localVarReturnValue *StatusResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HealthAPIService.GetStatusHealthStatusGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GetStatusHealthStatusGet") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -330,3 +343,135 @@ func (a *HealthAPIService) GetStatusHealthStatusGetExecute(r ApiGetStatusHealthS return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiGroupsPostConfigurationAppV1GroupsPostRequest struct { + ctx context.Context + ApiService *ConfigurationAPIService + groupsPostRequest *GroupsPostRequest +} + +func (r ApiGroupsPostConfigurationAppV1GroupsPostRequest) GroupsPostRequest(groupsPostRequest GroupsPostRequest) ApiGroupsPostConfigurationAppV1GroupsPostRequest { + r.groupsPostRequest = &groupsPostRequest + return r +} + +func (r ApiGroupsPostConfigurationAppV1GroupsPostRequest) Execute() (*GroupsPostResponse, *http.Response, error) { + return r.ApiService.GroupsPostConfigurationAppV1GroupsPostExecute(r) +} + +/* +GroupsPostConfigurationAppV1GroupsPost Groups Post + +Create a new group with the group identified in `parent_uid` as its parent + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGroupsPostConfigurationAppV1GroupsPostRequest +*/ +func (a *ConfigurationAPIService) GroupsPostConfigurationAppV1GroupsPost(ctx context.Context) ApiGroupsPostConfigurationAppV1GroupsPostRequest { + return ApiGroupsPostConfigurationAppV1GroupsPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return GroupsPostResponse +func (a *ConfigurationAPIService) GroupsPostConfigurationAppV1GroupsPostExecute(r ApiGroupsPostConfigurationAppV1GroupsPostRequest) (*GroupsPostResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GroupsPostResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GroupsPostConfigurationAppV1GroupsPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/configuration/app/v1/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.groupsPostRequest == nil { + return localVarReturnValue, nil, reportError("groupsPostRequest is required and must be specified") + } + + // 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 + } + // body params + localVarPostBody = r.groupsPostRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode >= 500 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/pkg/config-api-client/client.go b/pkg/config-api-client/client.go index d9d8962d..fb7e471b 100644 --- a/pkg/config-api-client/client.go +++ b/pkg/config-api-client/client.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -40,7 +41,7 @@ var ( queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) -// APIClient manages communication with the FastAPI API v1.0.0 +// APIClient manages communication with the Configuration Api API v1.2.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration @@ -48,7 +49,7 @@ type APIClient struct { // API Services - HealthAPI *HealthAPIService + ConfigurationAPI *ConfigurationAPIService } type service struct { @@ -67,7 +68,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services - c.HealthAPI = (*HealthAPIService)(&c.common) + c.ConfigurationAPI = (*ConfigurationAPIService)(&c.common) return c } @@ -409,6 +410,11 @@ func (c *APIClient) prepareRequest( // Walk through any authentication. + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } for header, value := range c.cfg.DefaultHeader { diff --git a/pkg/config-api-client/configuration.go b/pkg/config-api-client/configuration.go index cdd232c0..91ecec15 100644 --- a/pkg/config-api-client/configuration.go +++ b/pkg/config-api-client/configuration.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -28,6 +29,9 @@ func (c contextKey) String() string { } var ( + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + // ContextServerIndex uses a server configuration from the index. ContextServerIndex = contextKey("serverIndex") @@ -90,7 +94,11 @@ func NewConfiguration() *Configuration { Debug: false, Servers: ServerConfigurations{ { - URL: "", + URL: "https://api.capenetworks.com", + Description: "No description provided", + }, + { + URL: "https://api.staging.capedev.io", Description: "No description provided", }, }, diff --git a/pkg/config-api-client/docs/HealthAPI.md b/pkg/config-api-client/docs/ConfigurationAPI.md similarity index 50% rename from pkg/config-api-client/docs/HealthAPI.md rename to pkg/config-api-client/docs/ConfigurationAPI.md index 8c6a1a7f..f93355d4 100644 --- a/pkg/config-api-client/docs/HealthAPI.md +++ b/pkg/config-api-client/docs/ConfigurationAPI.md @@ -1,12 +1,13 @@ -# \HealthAPI +# \ConfigurationAPI -All URIs are relative to *http://localhost* +All URIs are relative to *https://api.capenetworks.com* Method | HTTP request | Description ------------- | ------------- | ------------- -[**GetLivezHealthLivezGet**](HealthAPI.md#GetLivezHealthLivezGet) | **Get** /health/livez | Live health check -[**GetReadyzHealthReadyzGet**](HealthAPI.md#GetReadyzHealthReadyzGet) | **Get** /health/readyz | Ready health check -[**GetStatusHealthStatusGet**](HealthAPI.md#GetStatusHealthStatusGet) | **Get** /health/status | Service stats endpoint +[**GetLivezHealthLivezGet**](ConfigurationAPI.md#GetLivezHealthLivezGet) | **Get** /health/livez | Live health check +[**GetReadyzHealthReadyzGet**](ConfigurationAPI.md#GetReadyzHealthReadyzGet) | **Get** /health/readyz | Ready health check +[**GetStatusHealthStatusGet**](ConfigurationAPI.md#GetStatusHealthStatusGet) | **Get** /health/status | Service stats endpoint +[**GroupsPostConfigurationAppV1GroupsPost**](ConfigurationAPI.md#GroupsPostConfigurationAppV1GroupsPost) | **Post** /configuration/app/v1/groups | Groups Post @@ -34,13 +35,13 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.HealthAPI.GetLivezHealthLivezGet(context.Background()).Execute() + resp, r, err := apiClient.ConfigurationAPI.GetLivezHealthLivezGet(context.Background()).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `HealthAPI.GetLivezHealthLivezGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `ConfigurationAPI.GetLivezHealthLivezGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetLivezHealthLivezGet`: LivenessResponse - fmt.Fprintf(os.Stdout, "Response from `HealthAPI.GetLivezHealthLivezGet`: %v\n", resp) + fmt.Fprintf(os.Stdout, "Response from `ConfigurationAPI.GetLivezHealthLivezGet`: %v\n", resp) } ``` @@ -95,13 +96,13 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.HealthAPI.GetReadyzHealthReadyzGet(context.Background()).Execute() + resp, r, err := apiClient.ConfigurationAPI.GetReadyzHealthReadyzGet(context.Background()).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `HealthAPI.GetReadyzHealthReadyzGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `ConfigurationAPI.GetReadyzHealthReadyzGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetReadyzHealthReadyzGet`: ReadinessResponse - fmt.Fprintf(os.Stdout, "Response from `HealthAPI.GetReadyzHealthReadyzGet`: %v\n", resp) + fmt.Fprintf(os.Stdout, "Response from `ConfigurationAPI.GetReadyzHealthReadyzGet`: %v\n", resp) } ``` @@ -156,13 +157,13 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.HealthAPI.GetStatusHealthStatusGet(context.Background()).Execute() + resp, r, err := apiClient.ConfigurationAPI.GetStatusHealthStatusGet(context.Background()).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `HealthAPI.GetStatusHealthStatusGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `ConfigurationAPI.GetStatusHealthStatusGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetStatusHealthStatusGet`: StatusResponse - fmt.Fprintf(os.Stdout, "Response from `HealthAPI.GetStatusHealthStatusGet`: %v\n", resp) + fmt.Fprintf(os.Stdout, "Response from `ConfigurationAPI.GetStatusHealthStatusGet`: %v\n", resp) } ``` @@ -192,3 +193,69 @@ No authorization required [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## GroupsPostConfigurationAppV1GroupsPost + +> GroupsPostResponse GroupsPostConfigurationAppV1GroupsPost(ctx).GroupsPostRequest(groupsPostRequest).Execute() + +Groups Post + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/aruba-uxi/configuration-api-terraform-provider/pkg/config-api-client" +) + +func main() { + groupsPostRequest := *openapiclient.NewGroupsPostRequest("ParentUid_example", "Name_example") // GroupsPostRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ConfigurationAPI.GroupsPostConfigurationAppV1GroupsPost(context.Background()).GroupsPostRequest(groupsPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ConfigurationAPI.GroupsPostConfigurationAppV1GroupsPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GroupsPostConfigurationAppV1GroupsPost`: GroupsPostResponse + fmt.Fprintf(os.Stdout, "Response from `ConfigurationAPI.GroupsPostConfigurationAppV1GroupsPost`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGroupsPostConfigurationAppV1GroupsPostRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupsPostRequest** | [**GroupsPostRequest**](GroupsPostRequest.md) | | + +### Return type + +[**GroupsPostResponse**](GroupsPostResponse.md) + +### Authorization + +[HTTPBearer](../README.md#HTTPBearer) + +### 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/pkg/config-api-client/docs/ErrorDetail.md b/pkg/config-api-client/docs/ErrorDetail.md new file mode 100644 index 00000000..93bcb469 --- /dev/null +++ b/pkg/config-api-client/docs/ErrorDetail.md @@ -0,0 +1,51 @@ +# ErrorDetail + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **string** | | + +## Methods + +### NewErrorDetail + +`func NewErrorDetail(message string, ) *ErrorDetail` + +NewErrorDetail instantiates a new ErrorDetail object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorDetailWithDefaults + +`func NewErrorDetailWithDefaults() *ErrorDetail` + +NewErrorDetailWithDefaults instantiates a new ErrorDetail object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMessage + +`func (o *ErrorDetail) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *ErrorDetail) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *ErrorDetail) SetMessage(v string)` + +SetMessage sets Message field to given value. + + + +[[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/pkg/config-api-client/docs/ErrorResponse.md b/pkg/config-api-client/docs/ErrorResponse.md index 367a34b6..28b4b120 100644 --- a/pkg/config-api-client/docs/ErrorResponse.md +++ b/pkg/config-api-client/docs/ErrorResponse.md @@ -4,14 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Data** | **map[string]string** | | -**Status** | **string** | | +**Detail** | [**[]ErrorDetail**](ErrorDetail.md) | | ## Methods ### NewErrorResponse -`func NewErrorResponse(data map[string]string, status string, ) *ErrorResponse` +`func NewErrorResponse(detail []ErrorDetail, ) *ErrorResponse` NewErrorResponse instantiates a new ErrorResponse object This constructor will assign default values to properties that have it defined, @@ -26,44 +25,24 @@ NewErrorResponseWithDefaults instantiates a new ErrorResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set -### GetData +### GetDetail -`func (o *ErrorResponse) GetData() map[string]string` +`func (o *ErrorResponse) GetDetail() []ErrorDetail` -GetData returns the Data field if non-nil, zero value otherwise. +GetDetail returns the Detail field if non-nil, zero value otherwise. -### GetDataOk +### GetDetailOk -`func (o *ErrorResponse) GetDataOk() (*map[string]string, bool)` +`func (o *ErrorResponse) GetDetailOk() (*[]ErrorDetail, bool)` -GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise +GetDetailOk returns a tuple with the Detail field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetData +### SetDetail -`func (o *ErrorResponse) SetData(v map[string]string)` +`func (o *ErrorResponse) SetDetail(v []ErrorDetail)` -SetData sets Data field to given value. - - -### GetStatus - -`func (o *ErrorResponse) GetStatus() string` - -GetStatus returns the Status field if non-nil, zero value otherwise. - -### GetStatusOk - -`func (o *ErrorResponse) GetStatusOk() (*string, bool)` - -GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetStatus - -`func (o *ErrorResponse) SetStatus(v string)` - -SetStatus sets Status field to given value. +SetDetail sets Detail field to given value. diff --git a/pkg/config-api-client/docs/GroupsPostRequest.md b/pkg/config-api-client/docs/GroupsPostRequest.md new file mode 100644 index 00000000..e54dd1e8 --- /dev/null +++ b/pkg/config-api-client/docs/GroupsPostRequest.md @@ -0,0 +1,72 @@ +# GroupsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ParentUid** | **string** | | +**Name** | **string** | | + +## Methods + +### NewGroupsPostRequest + +`func NewGroupsPostRequest(parentUid string, name string, ) *GroupsPostRequest` + +NewGroupsPostRequest instantiates a new GroupsPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGroupsPostRequestWithDefaults + +`func NewGroupsPostRequestWithDefaults() *GroupsPostRequest` + +NewGroupsPostRequestWithDefaults instantiates a new GroupsPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetParentUid + +`func (o *GroupsPostRequest) GetParentUid() string` + +GetParentUid returns the ParentUid field if non-nil, zero value otherwise. + +### GetParentUidOk + +`func (o *GroupsPostRequest) GetParentUidOk() (*string, bool)` + +GetParentUidOk returns a tuple with the ParentUid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParentUid + +`func (o *GroupsPostRequest) SetParentUid(v string)` + +SetParentUid sets ParentUid field to given value. + + +### GetName + +`func (o *GroupsPostRequest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *GroupsPostRequest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *GroupsPostRequest) SetName(v string)` + +SetName sets Name field to given value. + + + +[[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/pkg/config-api-client/docs/GroupsPostResponse.md b/pkg/config-api-client/docs/GroupsPostResponse.md new file mode 100644 index 00000000..33875307 --- /dev/null +++ b/pkg/config-api-client/docs/GroupsPostResponse.md @@ -0,0 +1,114 @@ +# GroupsPostResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ParentUid** | **string** | | +**Name** | **string** | | +**Uid** | **string** | | +**Path** | **string** | | + +## Methods + +### NewGroupsPostResponse + +`func NewGroupsPostResponse(parentUid string, name string, uid string, path string, ) *GroupsPostResponse` + +NewGroupsPostResponse instantiates a new GroupsPostResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGroupsPostResponseWithDefaults + +`func NewGroupsPostResponseWithDefaults() *GroupsPostResponse` + +NewGroupsPostResponseWithDefaults instantiates a new GroupsPostResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetParentUid + +`func (o *GroupsPostResponse) GetParentUid() string` + +GetParentUid returns the ParentUid field if non-nil, zero value otherwise. + +### GetParentUidOk + +`func (o *GroupsPostResponse) GetParentUidOk() (*string, bool)` + +GetParentUidOk returns a tuple with the ParentUid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParentUid + +`func (o *GroupsPostResponse) SetParentUid(v string)` + +SetParentUid sets ParentUid field to given value. + + +### GetName + +`func (o *GroupsPostResponse) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *GroupsPostResponse) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *GroupsPostResponse) SetName(v string)` + +SetName sets Name field to given value. + + +### GetUid + +`func (o *GroupsPostResponse) GetUid() string` + +GetUid returns the Uid field if non-nil, zero value otherwise. + +### GetUidOk + +`func (o *GroupsPostResponse) GetUidOk() (*string, bool)` + +GetUidOk returns a tuple with the Uid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUid + +`func (o *GroupsPostResponse) SetUid(v string)` + +SetUid sets Uid field to given value. + + +### GetPath + +`func (o *GroupsPostResponse) GetPath() string` + +GetPath returns the Path field if non-nil, zero value otherwise. + +### GetPathOk + +`func (o *GroupsPostResponse) GetPathOk() (*string, bool)` + +GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPath + +`func (o *GroupsPostResponse) SetPath(v string)` + +SetPath sets Path field to given value. + + + +[[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/pkg/config-api-client/docs/ReadinessErrorResponse.md b/pkg/config-api-client/docs/ReadinessErrorResponse.md new file mode 100644 index 00000000..434a948f --- /dev/null +++ b/pkg/config-api-client/docs/ReadinessErrorResponse.md @@ -0,0 +1,72 @@ +# ReadinessErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | **map[string]string** | | +**Status** | **string** | | + +## Methods + +### NewReadinessErrorResponse + +`func NewReadinessErrorResponse(data map[string]string, status string, ) *ReadinessErrorResponse` + +NewReadinessErrorResponse instantiates a new ReadinessErrorResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewReadinessErrorResponseWithDefaults + +`func NewReadinessErrorResponseWithDefaults() *ReadinessErrorResponse` + +NewReadinessErrorResponseWithDefaults instantiates a new ReadinessErrorResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetData + +`func (o *ReadinessErrorResponse) GetData() map[string]string` + +GetData returns the Data field if non-nil, zero value otherwise. + +### GetDataOk + +`func (o *ReadinessErrorResponse) GetDataOk() (*map[string]string, bool)` + +GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetData + +`func (o *ReadinessErrorResponse) SetData(v map[string]string)` + +SetData sets Data field to given value. + + +### GetStatus + +`func (o *ReadinessErrorResponse) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *ReadinessErrorResponse) GetStatusOk() (*string, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *ReadinessErrorResponse) SetStatus(v string)` + +SetStatus sets Status field to given value. + + + +[[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/pkg/config-api-client/model_error_detail.go b/pkg/config-api-client/model_error_detail.go new file mode 100644 index 00000000..232bb692 --- /dev/null +++ b/pkg/config-api-client/model_error_detail.go @@ -0,0 +1,157 @@ +/* +Configuration Api + +Nice description goes here + +API version: 1.2.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ErrorDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorDetail{} + +// ErrorDetail struct for ErrorDetail +type ErrorDetail struct { + Message string `json:"message"` +} + +type _ErrorDetail ErrorDetail + +// NewErrorDetail instantiates a new ErrorDetail object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorDetail(message string) *ErrorDetail { + this := ErrorDetail{} + this.Message = message + return &this +} + +// NewErrorDetailWithDefaults instantiates a new ErrorDetail object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorDetailWithDefaults() *ErrorDetail { + this := ErrorDetail{} + return &this +} + +// GetMessage returns the Message field value +func (o *ErrorDetail) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorDetail) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorDetail) SetMessage(v string) { + o.Message = v +} + +func (o ErrorDetail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + return toSerialize, nil +} + +func (o *ErrorDetail) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorDetail := _ErrorDetail{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorDetail) + + if err != nil { + return err + } + + *o = ErrorDetail(varErrorDetail) + + return err +} + +type NullableErrorDetail struct { + value *ErrorDetail + isSet bool +} + +func (v NullableErrorDetail) Get() *ErrorDetail { + return v.value +} + +func (v *NullableErrorDetail) Set(val *ErrorDetail) { + v.value = val + v.isSet = true +} + +func (v NullableErrorDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorDetail(val *ErrorDetail) *NullableErrorDetail { + return &NullableErrorDetail{value: val, isSet: true} +} + +func (v NullableErrorDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_error_response.go b/pkg/config-api-client/model_error_response.go index 01ba5d29..5d563c2d 100644 --- a/pkg/config-api-client/model_error_response.go +++ b/pkg/config-api-client/model_error_response.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -21,8 +22,7 @@ var _ MappedNullable = &ErrorResponse{} // ErrorResponse struct for ErrorResponse type ErrorResponse struct { - Data map[string]string `json:"data"` - Status string `json:"status"` + Detail []ErrorDetail `json:"detail"` } type _ErrorResponse ErrorResponse @@ -31,10 +31,9 @@ type _ErrorResponse ErrorResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewErrorResponse(data map[string]string, status string) *ErrorResponse { +func NewErrorResponse(detail []ErrorDetail) *ErrorResponse { this := ErrorResponse{} - this.Data = data - this.Status = status + this.Detail = detail return &this } @@ -46,52 +45,28 @@ func NewErrorResponseWithDefaults() *ErrorResponse { return &this } -// GetData returns the Data field value -func (o *ErrorResponse) GetData() map[string]string { +// GetDetail returns the Detail field value +func (o *ErrorResponse) GetDetail() []ErrorDetail { if o == nil { - var ret map[string]string + var ret []ErrorDetail return ret } - return o.Data + return o.Detail } -// GetDataOk returns a tuple with the Data field value +// GetDetailOk returns a tuple with the Detail field value // and a boolean to check if the value has been set. -func (o *ErrorResponse) GetDataOk() (*map[string]string, bool) { +func (o *ErrorResponse) GetDetailOk() ([]ErrorDetail, bool) { if o == nil { return nil, false } - return &o.Data, true + return o.Detail, true } -// SetData sets field value -func (o *ErrorResponse) SetData(v map[string]string) { - o.Data = v -} - -// GetStatus returns the Status field value -func (o *ErrorResponse) GetStatus() string { - if o == nil { - var ret string - return ret - } - - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value -// and a boolean to check if the value has been set. -func (o *ErrorResponse) GetStatusOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Status, true -} - -// SetStatus sets field value -func (o *ErrorResponse) SetStatus(v string) { - o.Status = v +// SetDetail sets field value +func (o *ErrorResponse) SetDetail(v []ErrorDetail) { + o.Detail = v } func (o ErrorResponse) MarshalJSON() ([]byte, error) { @@ -104,8 +79,7 @@ func (o ErrorResponse) MarshalJSON() ([]byte, error) { func (o ErrorResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - toSerialize["status"] = o.Status + toSerialize["detail"] = o.Detail return toSerialize, nil } @@ -114,8 +88,7 @@ func (o *ErrorResponse) UnmarshalJSON(data []byte) (err error) { // by unmarshalling the object into a generic map with string keys and checking // that every required field exists as a key in the generic map. requiredProperties := []string{ - "data", - "status", + "detail", } allProperties := make(map[string]interface{}) diff --git a/pkg/config-api-client/model_groups_post_request.go b/pkg/config-api-client/model_groups_post_request.go new file mode 100644 index 00000000..7d4c1936 --- /dev/null +++ b/pkg/config-api-client/model_groups_post_request.go @@ -0,0 +1,185 @@ +/* +Configuration Api + +Nice description goes here + +API version: 1.2.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the GroupsPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupsPostRequest{} + +// GroupsPostRequest struct for GroupsPostRequest +type GroupsPostRequest struct { + ParentUid string `json:"parent_uid"` + Name string `json:"name"` +} + +type _GroupsPostRequest GroupsPostRequest + +// NewGroupsPostRequest instantiates a new GroupsPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGroupsPostRequest(parentUid string, name string) *GroupsPostRequest { + this := GroupsPostRequest{} + this.ParentUid = parentUid + this.Name = name + return &this +} + +// NewGroupsPostRequestWithDefaults instantiates a new GroupsPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGroupsPostRequestWithDefaults() *GroupsPostRequest { + this := GroupsPostRequest{} + return &this +} + +// GetParentUid returns the ParentUid field value +func (o *GroupsPostRequest) GetParentUid() string { + if o == nil { + var ret string + return ret + } + + return o.ParentUid +} + +// GetParentUidOk returns a tuple with the ParentUid field value +// and a boolean to check if the value has been set. +func (o *GroupsPostRequest) GetParentUidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ParentUid, true +} + +// SetParentUid sets field value +func (o *GroupsPostRequest) SetParentUid(v string) { + o.ParentUid = v +} + +// GetName returns the Name field value +func (o *GroupsPostRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GroupsPostRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GroupsPostRequest) SetName(v string) { + o.Name = v +} + +func (o GroupsPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupsPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["parent_uid"] = o.ParentUid + toSerialize["name"] = o.Name + return toSerialize, nil +} + +func (o *GroupsPostRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "parent_uid", + "name", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGroupsPostRequest := _GroupsPostRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGroupsPostRequest) + + if err != nil { + return err + } + + *o = GroupsPostRequest(varGroupsPostRequest) + + return err +} + +type NullableGroupsPostRequest struct { + value *GroupsPostRequest + isSet bool +} + +func (v NullableGroupsPostRequest) Get() *GroupsPostRequest { + return v.value +} + +func (v *NullableGroupsPostRequest) Set(val *GroupsPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableGroupsPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupsPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupsPostRequest(val *GroupsPostRequest) *NullableGroupsPostRequest { + return &NullableGroupsPostRequest{value: val, isSet: true} +} + +func (v NullableGroupsPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupsPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_groups_post_response.go b/pkg/config-api-client/model_groups_post_response.go new file mode 100644 index 00000000..dcb17dbe --- /dev/null +++ b/pkg/config-api-client/model_groups_post_response.go @@ -0,0 +1,241 @@ +/* +Configuration Api + +Nice description goes here + +API version: 1.2.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the GroupsPostResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupsPostResponse{} + +// GroupsPostResponse struct for GroupsPostResponse +type GroupsPostResponse struct { + ParentUid string `json:"parent_uid"` + Name string `json:"name"` + Uid string `json:"uid"` + Path string `json:"path"` +} + +type _GroupsPostResponse GroupsPostResponse + +// NewGroupsPostResponse instantiates a new GroupsPostResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGroupsPostResponse(parentUid string, name string, uid string, path string) *GroupsPostResponse { + this := GroupsPostResponse{} + this.ParentUid = parentUid + this.Name = name + this.Uid = uid + this.Path = path + return &this +} + +// NewGroupsPostResponseWithDefaults instantiates a new GroupsPostResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGroupsPostResponseWithDefaults() *GroupsPostResponse { + this := GroupsPostResponse{} + return &this +} + +// GetParentUid returns the ParentUid field value +func (o *GroupsPostResponse) GetParentUid() string { + if o == nil { + var ret string + return ret + } + + return o.ParentUid +} + +// GetParentUidOk returns a tuple with the ParentUid field value +// and a boolean to check if the value has been set. +func (o *GroupsPostResponse) GetParentUidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ParentUid, true +} + +// SetParentUid sets field value +func (o *GroupsPostResponse) SetParentUid(v string) { + o.ParentUid = v +} + +// GetName returns the Name field value +func (o *GroupsPostResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GroupsPostResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GroupsPostResponse) SetName(v string) { + o.Name = v +} + +// GetUid returns the Uid field value +func (o *GroupsPostResponse) GetUid() string { + if o == nil { + var ret string + return ret + } + + return o.Uid +} + +// GetUidOk returns a tuple with the Uid field value +// and a boolean to check if the value has been set. +func (o *GroupsPostResponse) GetUidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uid, true +} + +// SetUid sets field value +func (o *GroupsPostResponse) SetUid(v string) { + o.Uid = v +} + +// GetPath returns the Path field value +func (o *GroupsPostResponse) GetPath() string { + if o == nil { + var ret string + return ret + } + + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *GroupsPostResponse) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Path, true +} + +// SetPath sets field value +func (o *GroupsPostResponse) SetPath(v string) { + o.Path = v +} + +func (o GroupsPostResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupsPostResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["parent_uid"] = o.ParentUid + toSerialize["name"] = o.Name + toSerialize["uid"] = o.Uid + toSerialize["path"] = o.Path + return toSerialize, nil +} + +func (o *GroupsPostResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "parent_uid", + "name", + "uid", + "path", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGroupsPostResponse := _GroupsPostResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGroupsPostResponse) + + if err != nil { + return err + } + + *o = GroupsPostResponse(varGroupsPostResponse) + + return err +} + +type NullableGroupsPostResponse struct { + value *GroupsPostResponse + isSet bool +} + +func (v NullableGroupsPostResponse) Get() *GroupsPostResponse { + return v.value +} + +func (v *NullableGroupsPostResponse) Set(val *GroupsPostResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGroupsPostResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupsPostResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupsPostResponse(val *GroupsPostResponse) *NullableGroupsPostResponse { + return &NullableGroupsPostResponse{value: val, isSet: true} +} + +func (v NullableGroupsPostResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupsPostResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_liveness_response.go b/pkg/config-api-client/model_liveness_response.go index 05212499..33a44681 100644 --- a/pkg/config-api-client/model_liveness_response.go +++ b/pkg/config-api-client/model_liveness_response.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/pkg/config-api-client/model_readiness_error_response.go b/pkg/config-api-client/model_readiness_error_response.go new file mode 100644 index 00000000..5d87d08f --- /dev/null +++ b/pkg/config-api-client/model_readiness_error_response.go @@ -0,0 +1,185 @@ +/* +Configuration Api + +Nice description goes here + +API version: 1.2.0 +Contact: support@capenetworks.com +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package config_api_client + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ReadinessErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReadinessErrorResponse{} + +// ReadinessErrorResponse struct for ReadinessErrorResponse +type ReadinessErrorResponse struct { + Data map[string]string `json:"data"` + Status string `json:"status"` +} + +type _ReadinessErrorResponse ReadinessErrorResponse + +// NewReadinessErrorResponse instantiates a new ReadinessErrorResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewReadinessErrorResponse(data map[string]string, status string) *ReadinessErrorResponse { + this := ReadinessErrorResponse{} + this.Data = data + this.Status = status + return &this +} + +// NewReadinessErrorResponseWithDefaults instantiates a new ReadinessErrorResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewReadinessErrorResponseWithDefaults() *ReadinessErrorResponse { + this := ReadinessErrorResponse{} + return &this +} + +// GetData returns the Data field value +func (o *ReadinessErrorResponse) GetData() map[string]string { + if o == nil { + var ret map[string]string + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *ReadinessErrorResponse) GetDataOk() (*map[string]string, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value +func (o *ReadinessErrorResponse) SetData(v map[string]string) { + o.Data = v +} + +// GetStatus returns the Status field value +func (o *ReadinessErrorResponse) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ReadinessErrorResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ReadinessErrorResponse) SetStatus(v string) { + o.Status = v +} + +func (o ReadinessErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReadinessErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *ReadinessErrorResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "data", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varReadinessErrorResponse := _ReadinessErrorResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReadinessErrorResponse) + + if err != nil { + return err + } + + *o = ReadinessErrorResponse(varReadinessErrorResponse) + + return err +} + +type NullableReadinessErrorResponse struct { + value *ReadinessErrorResponse + isSet bool +} + +func (v NullableReadinessErrorResponse) Get() *ReadinessErrorResponse { + return v.value +} + +func (v *NullableReadinessErrorResponse) Set(val *ReadinessErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableReadinessErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableReadinessErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReadinessErrorResponse(val *ReadinessErrorResponse) *NullableReadinessErrorResponse { + return &NullableReadinessErrorResponse{value: val, isSet: true} +} + +func (v NullableReadinessErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReadinessErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/config-api-client/model_readiness_response.go b/pkg/config-api-client/model_readiness_response.go index a966b711..fa305770 100644 --- a/pkg/config-api-client/model_readiness_response.go +++ b/pkg/config-api-client/model_readiness_response.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/pkg/config-api-client/model_status_response.go b/pkg/config-api-client/model_status_response.go index f5f176ea..802144c8 100644 --- a/pkg/config-api-client/model_status_response.go +++ b/pkg/config-api-client/model_status_response.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/pkg/config-api-client/response.go b/pkg/config-api-client/response.go index bae492d8..125fc933 100644 --- a/pkg/config-api-client/response.go +++ b/pkg/config-api-client/response.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/pkg/config-api-client/test/api_configuration_test.go b/pkg/config-api-client/test/api_configuration_test.go new file mode 100644 index 00000000..1905f385 --- /dev/null +++ b/pkg/config-api-client/test/api_configuration_test.go @@ -0,0 +1,65 @@ +package config_api_client + +import ( + "context" + openapiclient "github.com/aruba-uxi/configuration-api-terraform-provider/pkg/config-api-client" + "github.com/h2non/gock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_config_api_client_ConfigurationAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + configuration.Host = "localhost:80" + configuration.Scheme = "http" + apiClient := openapiclient.NewAPIClient(configuration) + + defer gock.Off() + + t.Run("Test ConfigurationAPIService GetLivezHealthLivezGet", func(t *testing.T) { + + gock.New(configuration.Scheme + "://" + configuration.Host).Get("/health/livez").Reply(200).JSON(map[string]string{"status": "OK"}) + + resp, httpRes, err := apiClient.ConfigurationAPI.GetLivezHealthLivezGet(context.Background()).Execute() + + require.Nil(t, err) + assert.Equal(t, httpRes.StatusCode, 200) + assert.Equal(t, resp, &openapiclient.LivenessResponse{Status: "OK"}) + }) + + t.Run("Test ConfigurationAPIService GetReadyzHealthReadyzGet", func(t *testing.T) { + + gock.New(configuration.Scheme + "://" + configuration.Host).Get("/health/readyz").Reply(200).JSON(map[string]interface{}{"status": "OK", "data": map[string]string{}}) + + resp, httpRes, err := apiClient.ConfigurationAPI.GetReadyzHealthReadyzGet(context.Background()).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, resp, &openapiclient.ReadinessResponse{Status: "OK", Data: map[string]string{}}) + }) + + t.Run("Test ConfigurationAPIService GetStatusHealthStatusGet", func(t *testing.T) { + + gock.New(configuration.Scheme + "://" + configuration.Host).Get("/health/status").Reply(200).JSON(map[string]string{"name": "Configuration-API", "version": "1.0.0"}) + + resp, httpRes, err := apiClient.ConfigurationAPI.GetStatusHealthStatusGet(context.Background()).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, resp, &openapiclient.StatusResponse{Name: "Configuration-API", Version: "1.0.0"}) + }) + + t.Run("Test ConfigurationAPIService GroupsPostConfigurationAppV1GroupsPost", func(t *testing.T) { + + gock.New(configuration.Scheme + "://" + configuration.Host).Post("/configuration/app/v1/groups").Reply(200).JSON(map[string]string{"parent_uid": "parent.uid", "name": "name", "uid": "node", "path": "parent.uid.node"}) + groups_post_request := openapiclient.NewGroupsPostRequest("parent_uid", "name") + resp, httpRes, err := apiClient.ConfigurationAPI.GroupsPostConfigurationAppV1GroupsPost(context.Background()).GroupsPostRequest(*groups_post_request).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, resp, &openapiclient.GroupsPostResponse{ParentUid: "parent.uid", Name: "name", Uid: "node", Path: "parent.uid.node"}) + }) + +} diff --git a/pkg/config-api-client/test/api_health_test.go b/pkg/config-api-client/test/api_health_test.go deleted file mode 100644 index 4efd3bd8..00000000 --- a/pkg/config-api-client/test/api_health_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package openapi - -import ( - "context" - "testing" - - "github.com/h2non/gock" - - "github.com/aruba-uxi/configuration-api-terraform-provider/pkg/config-api-client" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func Test_openapi_HealthAPIService(t *testing.T) { - - configuration := config_api_client.NewConfiguration() - configuration.Host = "localhost:80" - configuration.Scheme = "http" - apiClient := config_api_client.NewAPIClient(configuration) - - defer gock.Off() - - t.Run("Test HealthAPIService GetLivezHealthLivezGet", func(t *testing.T) { - - gock.New(configuration.Scheme + "://" + configuration.Host).Get("/health/livez").Reply(200).JSON(map[string]string{"status": "OK"}) - - resp, httpRes, err := apiClient.HealthAPI.GetLivezHealthLivezGet(context.Background()).Execute() - - require.Nil(t, err) - assert.Equal(t, httpRes.StatusCode, 200) - assert.Equal(t, resp, &config_api_client.LivenessResponse{Status: "OK"}) - }) - - t.Run("Test HealthAPIService GetReadyzHealthReadyzGet", func(t *testing.T) { - - gock.New(configuration.Scheme + "://" + configuration.Host).Get("/health/readyz").Reply(200).JSON(map[string]interface{}{"status": "OK", "data": map[string]string{}}) - - resp, httpRes, err := apiClient.HealthAPI.GetReadyzHealthReadyzGet(context.Background()).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &config_api_client.ReadinessResponse{Status: "OK", Data: map[string]string{}}) - }) - - t.Run("Test HealthAPIService GetStatusHealthStatusGet", func(t *testing.T) { - - gock.New(configuration.Scheme + "://" + configuration.Host).Get("/health/status").Reply(200).JSON(map[string]string{"name": "Configuration-API", "version": "1.0.0"}) - - resp, httpRes, err := apiClient.HealthAPI.GetStatusHealthStatusGet(context.Background()).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, resp, &config_api_client.StatusResponse{Name: "Configuration-API", Version: "1.0.0"}) - }) - -} diff --git a/pkg/config-api-client/utils.go b/pkg/config-api-client/utils.go index b1204774..eb6c24a5 100644 --- a/pkg/config-api-client/utils.go +++ b/pkg/config-api-client/utils.go @@ -1,9 +1,10 @@ /* -FastAPI +Configuration Api -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +Nice description goes here -API version: 1.0.0 +API version: 1.2.0 +Contact: support@capenetworks.com */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.