Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update client #6

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]: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
MaraisKruger marked this conversation as resolved.
Show resolved Hide resolved
cd {{ CONFIG_API_CLIENT_DIR }} && go mod tidy
just fmt-client

Expand Down
13 changes: 10 additions & 3 deletions pkg/config-api-client/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -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
Expand Down
33 changes: 25 additions & 8 deletions pkg/config-api-client/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand All @@ -114,5 +131,5 @@ Each of these functions takes a value of the given basic type and returns a poin

## Author


[email protected]

229 changes: 229 additions & 0 deletions pkg/config-api-client/api/.openapi.source.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
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
Loading
Loading