feat: mostly terraform shenanigans, but TF can now create ssh keys and servers

This commit is contained in:
allanice001
2025-11-02 17:18:28 +00:00
parent 0d10d42442
commit 43f8549320
59 changed files with 6353 additions and 28 deletions

View File

@@ -3,6 +3,7 @@
README.md
api/openapi.yaml
api_auth.go
api_labels.go
api_me.go
api_me_api_keys.go
api_orgs.go
@@ -13,11 +14,13 @@ client.go
configuration.go
docs/AuthAPI.md
docs/DtoAuthStartResponse.md
docs/DtoCreateLabelRequest.md
docs/DtoCreateSSHRequest.md
docs/DtoCreateServerRequest.md
docs/DtoCreateTaintRequest.md
docs/DtoJWK.md
docs/DtoJWKS.md
docs/DtoLabelResponse.md
docs/DtoLogoutRequest.md
docs/DtoRefreshRequest.md
docs/DtoServerResponse.md
@@ -25,6 +28,7 @@ docs/DtoSshResponse.md
docs/DtoSshRevealResponse.md
docs/DtoTaintResponse.md
docs/DtoTokenPair.md
docs/DtoUpdateLabelRequest.md
docs/DtoUpdateServerRequest.md
docs/DtoUpdateTaintRequest.md
docs/HandlersCreateUserKeyRequest.md
@@ -37,6 +41,7 @@ docs/HandlersOrgKeyCreateResp.md
docs/HandlersOrgUpdateReq.md
docs/HandlersUpdateMeRequest.md
docs/HandlersUserAPIKeyOut.md
docs/LabelsAPI.md
docs/MeAPI.md
docs/MeAPIKeysAPI.md
docs/ModelsAPIKey.md
@@ -52,11 +57,13 @@ git_push.sh
go.mod
go.sum
model_dto_auth_start_response.go
model_dto_create_label_request.go
model_dto_create_server_request.go
model_dto_create_ssh_request.go
model_dto_create_taint_request.go
model_dto_jwk.go
model_dto_jwks.go
model_dto_label_response.go
model_dto_logout_request.go
model_dto_refresh_request.go
model_dto_server_response.go
@@ -64,6 +71,7 @@ model_dto_ssh_response.go
model_dto_ssh_reveal_response.go
model_dto_taint_response.go
model_dto_token_pair.go
model_dto_update_label_request.go
model_dto_update_server_request.go
model_dto_update_taint_request.go
model_handlers_create_user_key_request.go
@@ -82,5 +90,4 @@ model_models_user.go
model_models_user_email.go
model_utils_error_response.go
response.go
test/api_taints_test.go
utils.go

View File

@@ -83,6 +83,11 @@ Class | Method | HTTP request | Description
*AuthAPI* | [**GetJWKS**](docs/AuthAPI.md#getjwks) | **Get** /.well-known/jwks.json | Get JWKS
*AuthAPI* | [**Logout**](docs/AuthAPI.md#logout) | **Post** /auth/logout | Revoke refresh token family (logout everywhere)
*AuthAPI* | [**Refresh**](docs/AuthAPI.md#refresh) | **Post** /auth/refresh | Rotate refresh token
*LabelsAPI* | [**CreateLabel**](docs/LabelsAPI.md#createlabel) | **Post** /labels | Create label (org scoped)
*LabelsAPI* | [**DeleteLabel**](docs/LabelsAPI.md#deletelabel) | **Delete** /labels/{id} | Delete label (org scoped)
*LabelsAPI* | [**GetLabel**](docs/LabelsAPI.md#getlabel) | **Get** /labels/{id} | Get label by ID (org scoped)
*LabelsAPI* | [**ListLabels**](docs/LabelsAPI.md#listlabels) | **Get** /labels | List node labels (org scoped)
*LabelsAPI* | [**UpdateLabel**](docs/LabelsAPI.md#updatelabel) | **Patch** /labels/{id} | Update label (org scoped)
*MeAPI* | [**GetMe**](docs/MeAPI.md#getme) | **Get** /me | Get current user profile
*MeAPI* | [**UpdateMe**](docs/MeAPI.md#updateme) | **Patch** /me | Update current user profile
*MeAPIKeysAPI* | [**CreateUserAPIKey**](docs/MeAPIKeysAPI.md#createuserapikey) | **Post** /me/api-keys | Create a new user API key
@@ -119,11 +124,13 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [DtoAuthStartResponse](docs/DtoAuthStartResponse.md)
- [DtoCreateLabelRequest](docs/DtoCreateLabelRequest.md)
- [DtoCreateSSHRequest](docs/DtoCreateSSHRequest.md)
- [DtoCreateServerRequest](docs/DtoCreateServerRequest.md)
- [DtoCreateTaintRequest](docs/DtoCreateTaintRequest.md)
- [DtoJWK](docs/DtoJWK.md)
- [DtoJWKS](docs/DtoJWKS.md)
- [DtoLabelResponse](docs/DtoLabelResponse.md)
- [DtoLogoutRequest](docs/DtoLogoutRequest.md)
- [DtoRefreshRequest](docs/DtoRefreshRequest.md)
- [DtoServerResponse](docs/DtoServerResponse.md)
@@ -131,6 +138,7 @@ Class | Method | HTTP request | Description
- [DtoSshRevealResponse](docs/DtoSshRevealResponse.md)
- [DtoTaintResponse](docs/DtoTaintResponse.md)
- [DtoTokenPair](docs/DtoTokenPair.md)
- [DtoUpdateLabelRequest](docs/DtoUpdateLabelRequest.md)
- [DtoUpdateServerRequest](docs/DtoUpdateServerRequest.md)
- [DtoUpdateTaintRequest](docs/DtoUpdateTaintRequest.md)
- [HandlersCreateUserKeyRequest](docs/HandlersCreateUserKeyRequest.md)

View File

@@ -103,6 +103,302 @@ paths:
summary: Begin social login
tags:
- Auth
/labels:
get:
description: "Returns node labels for the organization in X-Org-ID. Filters:\
\ `key`, `value`, and `q` (key contains). Add `include=node_pools` to include\
\ linked node groups."
operationId: ListLabels
parameters:
- description: Organization UUID
in: header
name: X-Org-ID
schema:
type: string
- description: Exact key
in: query
name: key
schema:
type: string
- description: Exact value
in: query
name: value
schema:
type: string
- description: Key contains (case-insensitive)
in: query
name: q
schema:
type: string
responses:
"200":
content:
application/json:
schema:
items:
$ref: "#/components/schemas/dto.LabelResponse"
type: array
description: OK
"401":
content:
application/json:
schema:
type: string
description: Unauthorized
"403":
content:
application/json:
schema:
type: string
description: organization required
"500":
content:
application/json:
schema:
type: string
description: failed to list node taints
security:
- BearerAuth: []
- OrgKeyAuth: []
- OrgSecretAuth: []
summary: List node labels (org scoped)
tags:
- Labels
post:
description: Creates a label.
operationId: CreateLabel
parameters:
- description: Organization UUID
in: header
name: X-Org-ID
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/dto.CreateLabelRequest"
description: Label payload
required: true
responses:
"201":
content:
application/json:
schema:
$ref: "#/components/schemas/dto.LabelResponse"
description: Created
"400":
content:
application/json:
schema:
type: string
description: invalid json / missing fields / invalid node_pool_ids
"401":
content:
application/json:
schema:
type: string
description: Unauthorized
"403":
content:
application/json:
schema:
type: string
description: organization required
"500":
content:
application/json:
schema:
type: string
description: create failed
security:
- BearerAuth: []
- OrgKeyAuth: []
- OrgSecretAuth: []
summary: Create label (org scoped)
tags:
- Labels
x-codegen-request-body-name: body
/labels/{id}:
delete:
description: Permanently deletes the label.
operationId: DeleteLabel
parameters:
- description: Organization UUID
in: header
name: X-Org-ID
schema:
type: string
- description: Label ID (UUID)
in: path
name: id
required: true
schema:
type: string
responses:
"204":
content:
application/json:
schema:
type: string
description: No Content
"400":
content:
application/json:
schema:
type: string
description: invalid id
"401":
content:
application/json:
schema:
type: string
description: Unauthorized
"403":
content:
application/json:
schema:
type: string
description: organization required
"500":
content:
application/json:
schema:
type: string
description: delete failed
security:
- BearerAuth: []
- OrgKeyAuth: []
- OrgSecretAuth: []
summary: Delete label (org scoped)
tags:
- Labels
get:
description: Returns one label.
operationId: GetLabel
parameters:
- description: Organization UUID
in: header
name: X-Org-ID
schema:
type: string
- description: Label ID (UUID)
in: path
name: id
required: true
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/dto.LabelResponse"
description: OK
"400":
content:
application/json:
schema:
type: string
description: invalid id
"401":
content:
application/json:
schema:
type: string
description: Unauthorized
"403":
content:
application/json:
schema:
type: string
description: organization required
"404":
content:
application/json:
schema:
type: string
description: not found
"500":
content:
application/json:
schema:
type: string
description: fetch failed
security:
- BearerAuth: []
- OrgKeyAuth: []
- OrgSecretAuth: []
summary: Get label by ID (org scoped)
tags:
- Labels
patch:
description: Partially update label fields.
operationId: UpdateLabel
parameters:
- description: Organization UUID
in: header
name: X-Org-ID
schema:
type: string
- description: Label ID (UUID)
in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/dto.UpdateLabelRequest"
description: Fields to update
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/dto.LabelResponse"
description: OK
"400":
content:
application/json:
schema:
type: string
description: invalid id / invalid json
"401":
content:
application/json:
schema:
type: string
description: Unauthorized
"403":
content:
application/json:
schema:
type: string
description: organization required
"404":
content:
application/json:
schema:
type: string
description: not found
"500":
content:
application/json:
schema:
type: string
description: update failed
security:
- BearerAuth: []
- OrgKeyAuth: []
- OrgSecretAuth: []
summary: Update label (org scoped)
tags:
- Labels
x-codegen-request-body-name: body
/me:
get:
operationId: GetMe
@@ -1452,6 +1748,13 @@ components:
example: https://accounts.google.com/o/oauth2/v2/auth?client_id=...
type: string
type: object
dto.CreateLabelRequest:
properties:
key:
type: string
value:
type: string
type: object
dto.CreateSSHRequest:
properties:
bits:
@@ -1547,6 +1850,19 @@ components:
$ref: "#/components/schemas/dto.JWK"
type: array
type: object
dto.LabelResponse:
example:
id: id
value: value
key: key
properties:
id:
type: string
key:
type: string
value:
type: string
type: object
dto.LogoutRequest:
properties:
refresh_token:
@@ -1685,6 +2001,13 @@ components:
example: Bearer
type: string
type: object
dto.UpdateLabelRequest:
properties:
key:
type: string
value:
type: string
type: object
dto.UpdateServerRequest:
properties:
hostname:

1075
sdk/go/api_labels.go Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -50,6 +50,8 @@ type APIClient struct {
AuthAPI *AuthAPIService
LabelsAPI *LabelsAPIService
MeAPI *MeAPIService
MeAPIKeysAPI *MeAPIKeysAPIService
@@ -80,6 +82,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
// API Services
c.AuthAPI = (*AuthAPIService)(&c.common)
c.LabelsAPI = (*LabelsAPIService)(&c.common)
c.MeAPI = (*MeAPIService)(&c.common)
c.MeAPIKeysAPI = (*MeAPIKeysAPIService)(&c.common)
c.OrgsAPI = (*OrgsAPIService)(&c.common)

View File

@@ -0,0 +1,82 @@
# DtoCreateLabelRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Key** | Pointer to **string** | | [optional]
**Value** | Pointer to **string** | | [optional]
## Methods
### NewDtoCreateLabelRequest
`func NewDtoCreateLabelRequest() *DtoCreateLabelRequest`
NewDtoCreateLabelRequest instantiates a new DtoCreateLabelRequest 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
### NewDtoCreateLabelRequestWithDefaults
`func NewDtoCreateLabelRequestWithDefaults() *DtoCreateLabelRequest`
NewDtoCreateLabelRequestWithDefaults instantiates a new DtoCreateLabelRequest 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
### GetKey
`func (o *DtoCreateLabelRequest) GetKey() string`
GetKey returns the Key field if non-nil, zero value otherwise.
### GetKeyOk
`func (o *DtoCreateLabelRequest) GetKeyOk() (*string, bool)`
GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetKey
`func (o *DtoCreateLabelRequest) SetKey(v string)`
SetKey sets Key field to given value.
### HasKey
`func (o *DtoCreateLabelRequest) HasKey() bool`
HasKey returns a boolean if a field has been set.
### GetValue
`func (o *DtoCreateLabelRequest) GetValue() string`
GetValue returns the Value field if non-nil, zero value otherwise.
### GetValueOk
`func (o *DtoCreateLabelRequest) GetValueOk() (*string, bool)`
GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetValue
`func (o *DtoCreateLabelRequest) SetValue(v string)`
SetValue sets Value field to given value.
### HasValue
`func (o *DtoCreateLabelRequest) HasValue() bool`
HasValue returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,108 @@
# DtoLabelResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | Pointer to **string** | | [optional]
**Key** | Pointer to **string** | | [optional]
**Value** | Pointer to **string** | | [optional]
## Methods
### NewDtoLabelResponse
`func NewDtoLabelResponse() *DtoLabelResponse`
NewDtoLabelResponse instantiates a new DtoLabelResponse 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
### NewDtoLabelResponseWithDefaults
`func NewDtoLabelResponseWithDefaults() *DtoLabelResponse`
NewDtoLabelResponseWithDefaults instantiates a new DtoLabelResponse 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
### GetId
`func (o *DtoLabelResponse) GetId() string`
GetId returns the Id field if non-nil, zero value otherwise.
### GetIdOk
`func (o *DtoLabelResponse) GetIdOk() (*string, bool)`
GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetId
`func (o *DtoLabelResponse) SetId(v string)`
SetId sets Id field to given value.
### HasId
`func (o *DtoLabelResponse) HasId() bool`
HasId returns a boolean if a field has been set.
### GetKey
`func (o *DtoLabelResponse) GetKey() string`
GetKey returns the Key field if non-nil, zero value otherwise.
### GetKeyOk
`func (o *DtoLabelResponse) GetKeyOk() (*string, bool)`
GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetKey
`func (o *DtoLabelResponse) SetKey(v string)`
SetKey sets Key field to given value.
### HasKey
`func (o *DtoLabelResponse) HasKey() bool`
HasKey returns a boolean if a field has been set.
### GetValue
`func (o *DtoLabelResponse) GetValue() string`
GetValue returns the Value field if non-nil, zero value otherwise.
### GetValueOk
`func (o *DtoLabelResponse) GetValueOk() (*string, bool)`
GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetValue
`func (o *DtoLabelResponse) SetValue(v string)`
SetValue sets Value field to given value.
### HasValue
`func (o *DtoLabelResponse) HasValue() bool`
HasValue returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,82 @@
# DtoUpdateLabelRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Key** | Pointer to **string** | | [optional]
**Value** | Pointer to **string** | | [optional]
## Methods
### NewDtoUpdateLabelRequest
`func NewDtoUpdateLabelRequest() *DtoUpdateLabelRequest`
NewDtoUpdateLabelRequest instantiates a new DtoUpdateLabelRequest 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
### NewDtoUpdateLabelRequestWithDefaults
`func NewDtoUpdateLabelRequestWithDefaults() *DtoUpdateLabelRequest`
NewDtoUpdateLabelRequestWithDefaults instantiates a new DtoUpdateLabelRequest 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
### GetKey
`func (o *DtoUpdateLabelRequest) GetKey() string`
GetKey returns the Key field if non-nil, zero value otherwise.
### GetKeyOk
`func (o *DtoUpdateLabelRequest) GetKeyOk() (*string, bool)`
GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetKey
`func (o *DtoUpdateLabelRequest) SetKey(v string)`
SetKey sets Key field to given value.
### HasKey
`func (o *DtoUpdateLabelRequest) HasKey() bool`
HasKey returns a boolean if a field has been set.
### GetValue
`func (o *DtoUpdateLabelRequest) GetValue() string`
GetValue returns the Value field if non-nil, zero value otherwise.
### GetValueOk
`func (o *DtoUpdateLabelRequest) GetValueOk() (*string, bool)`
GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetValue
`func (o *DtoUpdateLabelRequest) SetValue(v string)`
SetValue sets Value field to given value.
### HasValue
`func (o *DtoUpdateLabelRequest) HasValue() bool`
HasValue returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

371
sdk/go/docs/LabelsAPI.md Normal file
View File

@@ -0,0 +1,371 @@
# \LabelsAPI
All URIs are relative to *http://localhost:8080/api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**CreateLabel**](LabelsAPI.md#CreateLabel) | **Post** /labels | Create label (org scoped)
[**DeleteLabel**](LabelsAPI.md#DeleteLabel) | **Delete** /labels/{id} | Delete label (org scoped)
[**GetLabel**](LabelsAPI.md#GetLabel) | **Get** /labels/{id} | Get label by ID (org scoped)
[**ListLabels**](LabelsAPI.md#ListLabels) | **Get** /labels | List node labels (org scoped)
[**UpdateLabel**](LabelsAPI.md#UpdateLabel) | **Patch** /labels/{id} | Update label (org scoped)
## CreateLabel
> DtoLabelResponse CreateLabel(ctx).Body(body).XOrgID(xOrgID).Execute()
Create label (org scoped)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/glueops/autoglue-sdk"
)
func main() {
body := *openapiclient.NewDtoCreateLabelRequest() // DtoCreateLabelRequest | Label payload
xOrgID := "xOrgID_example" // string | Organization UUID (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LabelsAPI.CreateLabel(context.Background()).Body(body).XOrgID(xOrgID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LabelsAPI.CreateLabel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateLabel`: DtoLabelResponse
fmt.Fprintf(os.Stdout, "Response from `LabelsAPI.CreateLabel`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateLabelRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**DtoCreateLabelRequest**](DtoCreateLabelRequest.md) | Label payload |
**xOrgID** | **string** | Organization UUID |
### Return type
[**DtoLabelResponse**](DtoLabelResponse.md)
### Authorization
[OrgKeyAuth](../README.md#OrgKeyAuth), [OrgSecretAuth](../README.md#OrgSecretAuth), [BearerAuth](../README.md#BearerAuth)
### 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)
## DeleteLabel
> string DeleteLabel(ctx, id).XOrgID(xOrgID).Execute()
Delete label (org scoped)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/glueops/autoglue-sdk"
)
func main() {
id := "id_example" // string | Label ID (UUID)
xOrgID := "xOrgID_example" // string | Organization UUID (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LabelsAPI.DeleteLabel(context.Background(), id).XOrgID(xOrgID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LabelsAPI.DeleteLabel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteLabel`: string
fmt.Fprintf(os.Stdout, "Response from `LabelsAPI.DeleteLabel`: %v\n", resp)
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**id** | **string** | Label ID (UUID) |
### Other Parameters
Other parameters are passed through a pointer to a apiDeleteLabelRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**xOrgID** | **string** | Organization UUID |
### Return type
**string**
### Authorization
[OrgKeyAuth](../README.md#OrgKeyAuth), [OrgSecretAuth](../README.md#OrgSecretAuth), [BearerAuth](../README.md#BearerAuth)
### 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)
## GetLabel
> DtoLabelResponse GetLabel(ctx, id).XOrgID(xOrgID).Execute()
Get label by ID (org scoped)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/glueops/autoglue-sdk"
)
func main() {
id := "id_example" // string | Label ID (UUID)
xOrgID := "xOrgID_example" // string | Organization UUID (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LabelsAPI.GetLabel(context.Background(), id).XOrgID(xOrgID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LabelsAPI.GetLabel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetLabel`: DtoLabelResponse
fmt.Fprintf(os.Stdout, "Response from `LabelsAPI.GetLabel`: %v\n", resp)
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**id** | **string** | Label ID (UUID) |
### Other Parameters
Other parameters are passed through a pointer to a apiGetLabelRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**xOrgID** | **string** | Organization UUID |
### Return type
[**DtoLabelResponse**](DtoLabelResponse.md)
### Authorization
[OrgKeyAuth](../README.md#OrgKeyAuth), [OrgSecretAuth](../README.md#OrgSecretAuth), [BearerAuth](../README.md#BearerAuth)
### 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)
## ListLabels
> []DtoLabelResponse ListLabels(ctx).XOrgID(xOrgID).Key(key).Value(value).Q(q).Execute()
List node labels (org scoped)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/glueops/autoglue-sdk"
)
func main() {
xOrgID := "xOrgID_example" // string | Organization UUID (optional)
key := "key_example" // string | Exact key (optional)
value := "value_example" // string | Exact value (optional)
q := "q_example" // string | Key contains (case-insensitive) (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LabelsAPI.ListLabels(context.Background()).XOrgID(xOrgID).Key(key).Value(value).Q(q).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LabelsAPI.ListLabels``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListLabels`: []DtoLabelResponse
fmt.Fprintf(os.Stdout, "Response from `LabelsAPI.ListLabels`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiListLabelsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**xOrgID** | **string** | Organization UUID |
**key** | **string** | Exact key |
**value** | **string** | Exact value |
**q** | **string** | Key contains (case-insensitive) |
### Return type
[**[]DtoLabelResponse**](DtoLabelResponse.md)
### Authorization
[OrgKeyAuth](../README.md#OrgKeyAuth), [OrgSecretAuth](../README.md#OrgSecretAuth), [BearerAuth](../README.md#BearerAuth)
### 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)
## UpdateLabel
> DtoLabelResponse UpdateLabel(ctx, id).Body(body).XOrgID(xOrgID).Execute()
Update label (org scoped)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/glueops/autoglue-sdk"
)
func main() {
id := "id_example" // string | Label ID (UUID)
body := *openapiclient.NewDtoUpdateLabelRequest() // DtoUpdateLabelRequest | Fields to update
xOrgID := "xOrgID_example" // string | Organization UUID (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.LabelsAPI.UpdateLabel(context.Background(), id).Body(body).XOrgID(xOrgID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LabelsAPI.UpdateLabel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateLabel`: DtoLabelResponse
fmt.Fprintf(os.Stdout, "Response from `LabelsAPI.UpdateLabel`: %v\n", resp)
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**id** | **string** | Label ID (UUID) |
### Other Parameters
Other parameters are passed through a pointer to a apiUpdateLabelRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**DtoUpdateLabelRequest**](DtoUpdateLabelRequest.md) | Fields to update |
**xOrgID** | **string** | Organization UUID |
### Return type
[**DtoLabelResponse**](DtoLabelResponse.md)
### Authorization
[OrgKeyAuth](../README.md#OrgKeyAuth), [OrgSecretAuth](../README.md#OrgSecretAuth), [BearerAuth](../README.md#BearerAuth)
### 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)

View File

@@ -0,0 +1,160 @@
/*
AutoGlue API
API for managing K3s clusters across cloud providers
API version: 1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package autoglue
import (
"encoding/json"
)
// checks if the DtoCreateLabelRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DtoCreateLabelRequest{}
// DtoCreateLabelRequest struct for DtoCreateLabelRequest
type DtoCreateLabelRequest struct {
Key *string `json:"key,omitempty"`
Value *string `json:"value,omitempty"`
}
// NewDtoCreateLabelRequest instantiates a new DtoCreateLabelRequest 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 NewDtoCreateLabelRequest() *DtoCreateLabelRequest {
this := DtoCreateLabelRequest{}
return &this
}
// NewDtoCreateLabelRequestWithDefaults instantiates a new DtoCreateLabelRequest 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 NewDtoCreateLabelRequestWithDefaults() *DtoCreateLabelRequest {
this := DtoCreateLabelRequest{}
return &this
}
// GetKey returns the Key field value if set, zero value otherwise.
func (o *DtoCreateLabelRequest) GetKey() string {
if o == nil || IsNil(o.Key) {
var ret string
return ret
}
return *o.Key
}
// GetKeyOk returns a tuple with the Key field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DtoCreateLabelRequest) GetKeyOk() (*string, bool) {
if o == nil || IsNil(o.Key) {
return nil, false
}
return o.Key, true
}
// HasKey returns a boolean if a field has been set.
func (o *DtoCreateLabelRequest) HasKey() bool {
if o != nil && !IsNil(o.Key) {
return true
}
return false
}
// SetKey gets a reference to the given string and assigns it to the Key field.
func (o *DtoCreateLabelRequest) SetKey(v string) {
o.Key = &v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *DtoCreateLabelRequest) GetValue() string {
if o == nil || IsNil(o.Value) {
var ret string
return ret
}
return *o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DtoCreateLabelRequest) GetValueOk() (*string, bool) {
if o == nil || IsNil(o.Value) {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *DtoCreateLabelRequest) HasValue() bool {
if o != nil && !IsNil(o.Value) {
return true
}
return false
}
// SetValue gets a reference to the given string and assigns it to the Value field.
func (o *DtoCreateLabelRequest) SetValue(v string) {
o.Value = &v
}
func (o DtoCreateLabelRequest) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DtoCreateLabelRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Key) {
toSerialize["key"] = o.Key
}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}
return toSerialize, nil
}
type NullableDtoCreateLabelRequest struct {
value *DtoCreateLabelRequest
isSet bool
}
func (v NullableDtoCreateLabelRequest) Get() *DtoCreateLabelRequest {
return v.value
}
func (v *NullableDtoCreateLabelRequest) Set(val *DtoCreateLabelRequest) {
v.value = val
v.isSet = true
}
func (v NullableDtoCreateLabelRequest) IsSet() bool {
return v.isSet
}
func (v *NullableDtoCreateLabelRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDtoCreateLabelRequest(val *DtoCreateLabelRequest) *NullableDtoCreateLabelRequest {
return &NullableDtoCreateLabelRequest{value: val, isSet: true}
}
func (v NullableDtoCreateLabelRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDtoCreateLabelRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@@ -0,0 +1,196 @@
/*
AutoGlue API
API for managing K3s clusters across cloud providers
API version: 1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package autoglue
import (
"encoding/json"
)
// checks if the DtoLabelResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DtoLabelResponse{}
// DtoLabelResponse struct for DtoLabelResponse
type DtoLabelResponse struct {
Id *string `json:"id,omitempty"`
Key *string `json:"key,omitempty"`
Value *string `json:"value,omitempty"`
}
// NewDtoLabelResponse instantiates a new DtoLabelResponse 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 NewDtoLabelResponse() *DtoLabelResponse {
this := DtoLabelResponse{}
return &this
}
// NewDtoLabelResponseWithDefaults instantiates a new DtoLabelResponse 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 NewDtoLabelResponseWithDefaults() *DtoLabelResponse {
this := DtoLabelResponse{}
return &this
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *DtoLabelResponse) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DtoLabelResponse) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *DtoLabelResponse) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *DtoLabelResponse) SetId(v string) {
o.Id = &v
}
// GetKey returns the Key field value if set, zero value otherwise.
func (o *DtoLabelResponse) GetKey() string {
if o == nil || IsNil(o.Key) {
var ret string
return ret
}
return *o.Key
}
// GetKeyOk returns a tuple with the Key field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DtoLabelResponse) GetKeyOk() (*string, bool) {
if o == nil || IsNil(o.Key) {
return nil, false
}
return o.Key, true
}
// HasKey returns a boolean if a field has been set.
func (o *DtoLabelResponse) HasKey() bool {
if o != nil && !IsNil(o.Key) {
return true
}
return false
}
// SetKey gets a reference to the given string and assigns it to the Key field.
func (o *DtoLabelResponse) SetKey(v string) {
o.Key = &v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *DtoLabelResponse) GetValue() string {
if o == nil || IsNil(o.Value) {
var ret string
return ret
}
return *o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DtoLabelResponse) GetValueOk() (*string, bool) {
if o == nil || IsNil(o.Value) {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *DtoLabelResponse) HasValue() bool {
if o != nil && !IsNil(o.Value) {
return true
}
return false
}
// SetValue gets a reference to the given string and assigns it to the Value field.
func (o *DtoLabelResponse) SetValue(v string) {
o.Value = &v
}
func (o DtoLabelResponse) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DtoLabelResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Key) {
toSerialize["key"] = o.Key
}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}
return toSerialize, nil
}
type NullableDtoLabelResponse struct {
value *DtoLabelResponse
isSet bool
}
func (v NullableDtoLabelResponse) Get() *DtoLabelResponse {
return v.value
}
func (v *NullableDtoLabelResponse) Set(val *DtoLabelResponse) {
v.value = val
v.isSet = true
}
func (v NullableDtoLabelResponse) IsSet() bool {
return v.isSet
}
func (v *NullableDtoLabelResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDtoLabelResponse(val *DtoLabelResponse) *NullableDtoLabelResponse {
return &NullableDtoLabelResponse{value: val, isSet: true}
}
func (v NullableDtoLabelResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDtoLabelResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@@ -0,0 +1,160 @@
/*
AutoGlue API
API for managing K3s clusters across cloud providers
API version: 1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package autoglue
import (
"encoding/json"
)
// checks if the DtoUpdateLabelRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DtoUpdateLabelRequest{}
// DtoUpdateLabelRequest struct for DtoUpdateLabelRequest
type DtoUpdateLabelRequest struct {
Key *string `json:"key,omitempty"`
Value *string `json:"value,omitempty"`
}
// NewDtoUpdateLabelRequest instantiates a new DtoUpdateLabelRequest 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 NewDtoUpdateLabelRequest() *DtoUpdateLabelRequest {
this := DtoUpdateLabelRequest{}
return &this
}
// NewDtoUpdateLabelRequestWithDefaults instantiates a new DtoUpdateLabelRequest 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 NewDtoUpdateLabelRequestWithDefaults() *DtoUpdateLabelRequest {
this := DtoUpdateLabelRequest{}
return &this
}
// GetKey returns the Key field value if set, zero value otherwise.
func (o *DtoUpdateLabelRequest) GetKey() string {
if o == nil || IsNil(o.Key) {
var ret string
return ret
}
return *o.Key
}
// GetKeyOk returns a tuple with the Key field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DtoUpdateLabelRequest) GetKeyOk() (*string, bool) {
if o == nil || IsNil(o.Key) {
return nil, false
}
return o.Key, true
}
// HasKey returns a boolean if a field has been set.
func (o *DtoUpdateLabelRequest) HasKey() bool {
if o != nil && !IsNil(o.Key) {
return true
}
return false
}
// SetKey gets a reference to the given string and assigns it to the Key field.
func (o *DtoUpdateLabelRequest) SetKey(v string) {
o.Key = &v
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *DtoUpdateLabelRequest) GetValue() string {
if o == nil || IsNil(o.Value) {
var ret string
return ret
}
return *o.Value
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DtoUpdateLabelRequest) GetValueOk() (*string, bool) {
if o == nil || IsNil(o.Value) {
return nil, false
}
return o.Value, true
}
// HasValue returns a boolean if a field has been set.
func (o *DtoUpdateLabelRequest) HasValue() bool {
if o != nil && !IsNil(o.Value) {
return true
}
return false
}
// SetValue gets a reference to the given string and assigns it to the Value field.
func (o *DtoUpdateLabelRequest) SetValue(v string) {
o.Value = &v
}
func (o DtoUpdateLabelRequest) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DtoUpdateLabelRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Key) {
toSerialize["key"] = o.Key
}
if !IsNil(o.Value) {
toSerialize["value"] = o.Value
}
return toSerialize, nil
}
type NullableDtoUpdateLabelRequest struct {
value *DtoUpdateLabelRequest
isSet bool
}
func (v NullableDtoUpdateLabelRequest) Get() *DtoUpdateLabelRequest {
return v.value
}
func (v *NullableDtoUpdateLabelRequest) Set(val *DtoUpdateLabelRequest) {
v.value = val
v.isSet = true
}
func (v NullableDtoUpdateLabelRequest) IsSet() bool {
return v.isSet
}
func (v *NullableDtoUpdateLabelRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDtoUpdateLabelRequest(val *DtoUpdateLabelRequest) *NullableDtoUpdateLabelRequest {
return &NullableDtoUpdateLabelRequest{value: val, isSet: true}
}
func (v NullableDtoUpdateLabelRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDtoUpdateLabelRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@@ -0,0 +1,91 @@
/*
AutoGlue API
Testing LabelsAPIService
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
package autoglue
import (
"context"
openapiclient "github.com/glueops/autoglue-sdk"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)
func Test_autoglue_LabelsAPIService(t *testing.T) {
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
t.Run("Test LabelsAPIService CreateLabel", func(t *testing.T) {
t.Skip("skip test") // remove to run test
resp, httpRes, err := apiClient.LabelsAPI.CreateLabel(context.Background()).Execute()
require.Nil(t, err)
require.NotNil(t, resp)
assert.Equal(t, 200, httpRes.StatusCode)
})
t.Run("Test LabelsAPIService DeleteLabel", func(t *testing.T) {
t.Skip("skip test") // remove to run test
var id string
resp, httpRes, err := apiClient.LabelsAPI.DeleteLabel(context.Background(), id).Execute()
require.Nil(t, err)
require.NotNil(t, resp)
assert.Equal(t, 200, httpRes.StatusCode)
})
t.Run("Test LabelsAPIService GetLabel", func(t *testing.T) {
t.Skip("skip test") // remove to run test
var id string
resp, httpRes, err := apiClient.LabelsAPI.GetLabel(context.Background(), id).Execute()
require.Nil(t, err)
require.NotNil(t, resp)
assert.Equal(t, 200, httpRes.StatusCode)
})
t.Run("Test LabelsAPIService ListLabels", func(t *testing.T) {
t.Skip("skip test") // remove to run test
resp, httpRes, err := apiClient.LabelsAPI.ListLabels(context.Background()).Execute()
require.Nil(t, err)
require.NotNil(t, resp)
assert.Equal(t, 200, httpRes.StatusCode)
})
t.Run("Test LabelsAPIService UpdateLabel", func(t *testing.T) {
t.Skip("skip test") // remove to run test
var id string
resp, httpRes, err := apiClient.LabelsAPI.UpdateLabel(context.Background(), id).Execute()
require.Nil(t, err)
require.NotNil(t, resp)
assert.Equal(t, 200, httpRes.StatusCode)
})
}