From 9283acf4888b093958771bca7f98dd0db78676f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6ll?= Date: Wed, 24 Apr 2024 12:30:22 +0000 Subject: [PATCH] wip: create signing key --- api/api.yml | 173 +++- internal/api/adapters/db.go | 32 +- internal/api/controllers/operators.go | 61 +- internal/api/models/account.go | 26 + internal/api/models/operator.go | 8 +- internal/api/models/tokens.go | 17 + internal/api/ports/accounts.go | 13 + internal/api/ports/operators.go | 7 +- internal/api/ports/repos.go | 3 +- internal/api/services/api.go | 41 + internal/utils/utils.go | 7 +- pkg/apis/api.go | 42 +- pkg/apis/client.gen.go | 1228 ++++++++++++++++++++++--- pkg/apis/models.gen.go | 142 ++- pkg/apis/server.gen.go | 623 ++++++++++++- 15 files changed, 2186 insertions(+), 237 deletions(-) create mode 100644 internal/api/models/account.go create mode 100644 internal/api/models/tokens.go create mode 100644 internal/api/ports/accounts.go diff --git a/api/api.yml b/api/api.yml index 69dd68b3..3648c652 100644 --- a/api/api.yml +++ b/api/api.yml @@ -97,6 +97,149 @@ paths: parameters: operatorId: "$response.body#/id" + /operators/{operatorId}: + get: + summary: Gets an operator by ID + operationId: getOperator + parameters: + - $ref: "#/components/parameters/operatorId" + responses: + "200": + description: Successful + content: + application/json: + schema: + $ref: "#/components/schemas/Operator" + put: + summary: Updates an operator by ID + operationId: updateOperator + parameters: + - $ref: "#/components/parameters/operatorId" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Operator" + responses: + "200": + description: Successful + content: + application/json: + schema: + $ref: "#/components/schemas/Operator" + delete: + summary: Deletes an operator by ID + operationId: deleteOperator + parameters: + - $ref: "#/components/parameters/operatorId" + responses: + "204": + description: Successful + + /operators/{operatorId}/signing-keys: + get: + summary: List all signing keys for an operator + operationId: listOperatorSigningKeys + tags: + - Operator + produces: + - "application/json" + parameters: + - $ref: "#/components/parameters/operatorId" + - $ref: "#/components/parameters/offsetParam" + - $ref: "#/components/parameters/limitParam" + security: + - bearerAuth: ["read:signing-keys"] + responses: + "200": + description: Successfull response + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/PaginatedResult" + - type: object + properties: + results: + type: array + items: + $ref: "#/components/schemas/KeyPair" + post: + summary: Creates a new signing key + operationId: createOperatorSigningKey + tags: + - Operator + produces: + - "application/json" + parameters: + - $ref: "#/components/parameters/operatorId" + responses: + "201": + description: Created + content: + application/json: + schema: + $ref: "#/components/schemas/KeyPair" + links: + GetSigningKeyById: + operationId: getSigningKey + parameters: + operatorId: "$response.body#/operatorId" + signingKeyId: "$response.body#/id" + + /operators/{operatorId}/accounts: + get: + summary: List all accounts for an operator + operationId: listOperatorAccounts + tags: + - Operator + produces: + - "application/json" + parameters: + - $ref: "#/components/parameters/operatorId" + - $ref: "#/components/parameters/offsetParam" + - $ref: "#/components/parameters/limitParam" + security: + - bearerAuth: ["read:accounts"] + responses: + "200": + description: Successfull response + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/PaginatedResult" + - type: object + properties: + results: + type: array + items: + $ref: "#/components/schemas/Account" + post: + summary: Creates a new account + operationId: createOperatorAccount + tags: + - Operator + produces: + - "application/json" + parameters: + - $ref: "#/components/parameters/operatorId" + requestBody: + $ref: "#/components/requestBodies/CreateAccount" + responses: + "201": + description: Created + content: + application/json: + schema: + $ref: "#/components/schemas/Account" + links: + GetAccountById: + operationId: getAccount + parameters: + operatorId: "$response.body#/operatorId" + accountId: "$response.body#/id" + /teams: get: summary: List all teams @@ -164,7 +307,7 @@ paths: /teams/{teamId}/accounts: get: summary: List all accounts for a team - operationId: listAccounts + operationId: listTeamAccounts tags: - Team produces: @@ -595,6 +738,14 @@ components: maximum: 50 default: 20 description: The numbers of items to return. + operatorId: + in: path + name: operatorId + required: true + schema: + type: string + format: uuid + description: The id of the operator to retrieve. requestBodies: CreateTeam: @@ -616,6 +767,18 @@ components: type: string contactEmail: type: string + CreateAccount: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + description: + type: string securitySchemes: cookieAuth: @@ -709,7 +872,7 @@ components: properties: id: type: string - format: base32 + format: uuid readOnly: true name: type: string @@ -797,6 +960,12 @@ components: type: string contactEmail: type: string + key: + $ref: "#/components/schemas/KeyPair" + signingKeys: + type: array + items: + $ref: "#/components/schemas/KeyPair" createdAt: type: string format: date-time diff --git a/internal/api/adapters/db.go b/internal/api/adapters/db.go index a15644a1..f17b9416 100644 --- a/internal/api/adapters/db.go +++ b/internal/api/adapters/db.go @@ -3,6 +3,7 @@ package adapters import ( "context" + "github.com/google/uuid" "github.com/zeiss/typhoon/internal/api/models" "github.com/zeiss/typhoon/internal/api/ports" @@ -30,12 +31,14 @@ func (db *DB) RunMigrations() error { return db.conn.AutoMigrate( &models.NKey{}, &models.Operator{}, + &models.Account{}, &models.System{}, + &models.Token{}, ) } // GetOperator ... -func (db *DB) GetOperator(ctx context.Context, id string) (*models.Operator, error) { +func (db *DB) GetOperator(ctx context.Context, id uuid.UUID) (*models.Operator, error) { operator := &models.Operator{} if err := db.conn.Where("id = ?", id).First(operator).Error; err != nil { return nil, err @@ -44,6 +47,33 @@ func (db *DB) GetOperator(ctx context.Context, id string) (*models.Operator, err return operator, nil } +// DeleteOperator ... +func (db *DB) DeleteOperator(ctx context.Context, id uuid.UUID) error { + return db.conn.WithContext(ctx).Where("id = ?", id).Delete(&models.Operator{}).Error +} + +// CreateAccount ... +func (db *DB) CreateAccount(ctx context.Context, account *models.Account) error { + return db.conn.WithContext(ctx).Create(account).Error +} + +// CreateOperatorSigningKey ... +func (db *DB) CreateOperatorSigningKey(ctx context.Context, operatorID uuid.UUID, key *models.NKey) error { + return db.conn.WithContext(ctx).Transaction(func(tx *gorm.DB) error { + var operator models.Operator + if err := tx.Where("id = ?", operatorID).First(&operator).Error; err != nil { + return err + } + + err := tx.Model(&operator).Association("SigningKeys").Append(key) + if err != nil { + return err + } + + return nil + }) +} + // ListOperator ... func (db *DB) ListOperator(ctx context.Context, pagination models.Pagination[*models.Operator]) (*models.Pagination[*models.Operator], error) { operators := []*models.Operator{} diff --git a/internal/api/controllers/operators.go b/internal/api/controllers/operators.go index 60031725..30d7afe9 100644 --- a/internal/api/controllers/operators.go +++ b/internal/api/controllers/operators.go @@ -3,6 +3,7 @@ package controllers import ( "context" + "github.com/google/uuid" "github.com/nats-io/nkeys" "github.com/zeiss/typhoon/internal/api/models" "github.com/zeiss/typhoon/internal/api/ports" @@ -10,33 +11,32 @@ import ( // OperatorsController ... type OperatorsController struct { - db ports.Operators + db ports.Repositories } // NewOperatorsController ... -func NewOperatorsController(db ports.Operators) *OperatorsController { +func NewOperatorsController(db ports.Repositories) *OperatorsController { return &OperatorsController{db} } // CreateOperator ... func (c *OperatorsController) CreateOperator(ctx context.Context, name string) (*models.Operator, error) { - key, err := nkeys.CreateOperator() + pk, err := nkeys.CreateOperator() if err != nil { return nil, err } - id, err := key.PublicKey() + id, err := pk.PublicKey() if err != nil { return nil, err } - seed, err := key.Seed() + seed, err := pk.Seed() if err != nil { return nil, err } op := &models.Operator{ - ID: id, Key: models.NKey{ ID: id, Seed: seed, @@ -51,6 +51,55 @@ func (c *OperatorsController) CreateOperator(ctx context.Context, name string) ( return op, nil } +// CreateOperatorAccount ... +func (c *OperatorsController) CreateOperatorAccount(ctx context.Context, name string, operatorID uuid.UUID) (*models.Account, error) { + key, err := nkeys.CreateAccount() + if err != nil { + return nil, err + } + + id, err := key.PublicKey() + if err != nil { + return nil, err + } + + seed, err := key.Seed() + if err != nil { + return nil, err + } + + account := &models.Account{ + Name: name, + OperatorID: operatorID, + Key: models.NKey{ + ID: id, + Seed: seed, + }, + } + + err = c.db.CreateAccount(ctx, account) + if err != nil { + return nil, err + } + + return account, nil +} + +// CreateOperatorSigningKey ... +func (c *OperatorsController) CreateOperatorSigningKey(ctx context.Context, operatorID uuid.UUID) (*models.Operator, error) { + return nil, nil +} + +// DeleteOperator ... +func (c *OperatorsController) DeleteOperator(ctx context.Context, id uuid.UUID) error { + return c.db.DeleteOperator(ctx, id) +} + +// GetOperator ... +func (c *OperatorsController) GetOperator(ctx context.Context, id uuid.UUID) (*models.Operator, error) { + return c.db.GetOperator(ctx, id) +} + // ListOperator ... func (c *OperatorsController) ListOperator(ctx context.Context, pagination models.Pagination[*models.Operator]) (*models.Pagination[*models.Operator], error) { return c.db.ListOperator(ctx, pagination) diff --git a/internal/api/models/account.go b/internal/api/models/account.go new file mode 100644 index 00000000..7eb70f81 --- /dev/null +++ b/internal/api/models/account.go @@ -0,0 +1,26 @@ +package models + +import ( + "time" + + "github.com/google/uuid" + "gorm.io/gorm" +) + +// Account ... +type Account struct { + ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"` + Name string `json:"name"` + + // Operator is the operator that created the account. + Operator Operator `json:"operator"` + OperatorID uuid.UUID `json:"operator_id" gorm:"foreignKey:ID"` + + // Key is the issuer key identifier. + Key NKey `json:"key"` + KeyID string `json:"key_id" gorm:"foreignKey:ID"` + + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` +} diff --git a/internal/api/models/operator.go b/internal/api/models/operator.go index 2b64dafc..6a86ef36 100644 --- a/internal/api/models/operator.go +++ b/internal/api/models/operator.go @@ -3,18 +3,22 @@ package models import ( "time" + "github.com/google/uuid" "gorm.io/gorm" ) // Operator ... type Operator struct { - ID string `json:"id" gorm:"primaryKey"` - Name string `json:"name"` + ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"` + Name string `json:"name"` // Key is the issuer key identifier. Key NKey `json:"key"` KeyID string `json:"key_id" gorm:"foreignKey:ID"` + // Accounts is the list of accounts that the operator has. + SigningKeys []NKey `json:"signing_keys" gorm:"many2many:operator_signing_keys;foreignKey:ID;joinForeignKey:OperatorID;joinReferences:SigningKeyID"` + CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` diff --git a/internal/api/models/tokens.go b/internal/api/models/tokens.go new file mode 100644 index 00000000..253ba365 --- /dev/null +++ b/internal/api/models/tokens.go @@ -0,0 +1,17 @@ +package models + +import ( + "time" + + "gorm.io/gorm" +) + +// Token ... +type Token struct { + ID string `json:"id" gorm:"primaryKey"` + Token string `json:"token"` + + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` +} diff --git a/internal/api/ports/accounts.go b/internal/api/ports/accounts.go new file mode 100644 index 00000000..930d7ba9 --- /dev/null +++ b/internal/api/ports/accounts.go @@ -0,0 +1,13 @@ +package ports + +import ( + "context" + + "github.com/zeiss/typhoon/internal/api/models" +) + +// Accounts ... +type Accounts interface { + // CreateAccount creates a new account. + CreateAccount(ctx context.Context, account *models.Account) error +} diff --git a/internal/api/ports/operators.go b/internal/api/ports/operators.go index 2e621a67..f0abf095 100644 --- a/internal/api/ports/operators.go +++ b/internal/api/ports/operators.go @@ -3,15 +3,20 @@ package ports import ( "context" + "github.com/google/uuid" "github.com/zeiss/typhoon/internal/api/models" ) // Operators is the interface that wraps the methods to access data. type Operators interface { // GetOperator returns the operator with the given ID. - GetOperator(ctx context.Context, id string) (*models.Operator, error) + GetOperator(ctx context.Context, id uuid.UUID) (*models.Operator, error) // CreateOperator creates a new operator. CreateOperator(ctx context.Context, operator *models.Operator) error // ListOperator returns a list of operators. ListOperator(ctx context.Context, pagination models.Pagination[*models.Operator]) (*models.Pagination[*models.Operator], error) + // DeleteOperator deletes the operator with the given ID. + DeleteOperator(ctx context.Context, id uuid.UUID) error + // CreateOperatorSigningKey creates a new signing key for the operator. + CreateOperatorSigningKey(ctx context.Context, operatorID uuid.UUID, key *models.NKey) error } diff --git a/internal/api/ports/repos.go b/internal/api/ports/repos.go index abeed1db..9cdc5d1a 100644 --- a/internal/api/ports/repos.go +++ b/internal/api/ports/repos.go @@ -2,7 +2,8 @@ package ports // Repositories is the interface that wraps the methods to access data. type Repositories interface { - Build Systems Teams + Accounts + Operators } diff --git a/internal/api/services/api.go b/internal/api/services/api.go index 666d4b70..b94ddb06 100644 --- a/internal/api/services/api.go +++ b/internal/api/services/api.go @@ -16,6 +16,7 @@ type ApiHandlers struct { teams *controllers.TeamsController version *controllers.VersionController operators *controllers.OperatorsController + openapi.Unimplemented } @@ -34,6 +35,46 @@ func (a *ApiHandlers) CreateOperator(ctx context.Context, req openapi.CreateOper return openapi.CreateOperator201JSONResponse(openapi.Operator{Id: &operator.ID, Name: operator.Name}), nil } +// GetOperator ... +func (a *ApiHandlers) GetOperator(ctx context.Context, req openapi.GetOperatorRequestObject) (openapi.GetOperatorResponseObject, error) { + operator, err := a.operators.GetOperator(ctx, req.OperatorId) + if err != nil { + return nil, err + } + + return openapi.GetOperator200JSONResponse(openapi.Operator{Id: &operator.ID, Name: operator.Name}), nil +} + +// CreateAccount ... +func (a *ApiHandlers) CreateOperatorAccount(ctx context.Context, req openapi.CreateOperatorAccountRequestObject) (openapi.CreateOperatorAccountResponseObject, error) { + account, err := a.operators.CreateOperatorAccount(ctx, req.Body.Name, req.OperatorId) + if err != nil { + return nil, err + } + + resp := openapi.CreateOperatorAccount201JSONResponse( + openapi.Account{ + Id: &account.ID, + Name: account.Name, + CreatedAt: &account.CreatedAt, + UpdatedAt: &account.UpdatedAt, + DeletedAt: &account.DeletedAt.Time, + }, + ) + + return openapi.CreateOperatorAccount201JSONResponse(resp), nil +} + +// DeleteOperator ... +func (a *ApiHandlers) DeleteOperator(ctx context.Context, req openapi.DeleteOperatorRequestObject) (openapi.DeleteOperatorResponseObject, error) { + err := a.operators.DeleteOperator(ctx, req.OperatorId) + if err != nil { + return nil, err + } + + return openapi.DeleteOperator204Response(openapi.DeleteOperator204Response{}), nil +} + // ListOperator ... func (a *ApiHandlers) ListOperator(ctx context.Context, req openapi.ListOperatorRequestObject) (openapi.ListOperatorResponseObject, error) { pagination := models.Pagination[*models.Operator]{ diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 3f26bc74..39498baf 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -1,8 +1,13 @@ package utils +import "github.com/google/uuid" + // PtrInt returns a pointer to an int. func PtrInt(i int) *int { return &i } -// PtrIntF +// PtrUUID returns a pointer to a UUID. +func PtrUUID(u uuid.UUID) *uuid.UUID { + return &u +} diff --git a/pkg/apis/api.go b/pkg/apis/api.go index 3d75c099..24e5e1cb 100644 --- a/pkg/apis/api.go +++ b/pkg/apis/api.go @@ -15,6 +15,46 @@ func (u *Unimplemented) CreateOperator(ctx context.Context, request CreateOperat return nil, errors.New("not implemented") } +// ListAccounts ... +func (u *Unimplemented) ListOperatorAccounts(ctx context.Context, request ListOperatorAccountsRequestObject) (ListOperatorAccountsResponseObject, error) { + return nil, errors.New("not implemented") +} + +// CreateOperatorAccount ... +func (u *Unimplemented) CreateOperatorAccount(ctx context.Context, request CreateOperatorAccountRequestObject) (CreateOperatorAccountResponseObject, error) { + return nil, errors.New("not implemented") +} + +// ListOperatorSignKeys ... +func (u *Unimplemented) ListOperatorSignKeys(ctx context.Context, request ListOperatorSigningKeysRequestObject) (ListOperatorSigningKeysResponseObject, error) { + return nil, errors.New("not implemented") +} + +// CreateOperatorSignKey ... +func (u *Unimplemented) CreateOperatorSigningKey(ctx context.Context, request CreateOperatorSigningKeyRequestObject) (CreateOperatorSigningKeyResponseObject, error) { + return nil, errors.New("not implemented") +} + +// ListOperatorSigningKeys ... +func (u *Unimplemented) ListOperatorSigningKeys(ctx context.Context, request ListOperatorSigningKeysRequestObject) (ListOperatorSigningKeysResponseObject, error) { + return nil, errors.New("not implemented") +} + +// GetOperator ... +func (u *Unimplemented) GetOperator(ctx context.Context, request GetOperatorRequestObject) (GetOperatorResponseObject, error) { + return nil, errors.New("not implemented") +} + +// DeleteOperator ... +func (u *Unimplemented) DeleteOperator(ctx context.Context, request DeleteOperatorRequestObject) (DeleteOperatorResponseObject, error) { + return nil, errors.New("not implemented") +} + +// UpdateOperator ... +func (u *Unimplemented) UpdateOperator(ctx context.Context, request UpdateOperatorRequestObject) (UpdateOperatorResponseObject, error) { + return nil, errors.New("not implemented") +} + // ListOperators ... func (u *Unimplemented) ListOperator(ctx context.Context, request ListOperatorRequestObject) (ListOperatorResponseObject, error) { return nil, errors.New("not implemented") @@ -56,7 +96,7 @@ func (u *Unimplemented) GetTeam(ctx context.Context, request GetTeamRequestObjec } // ListAccounts ... -func (u *Unimplemented) ListAccounts(ctx context.Context, request ListAccountsRequestObject) (ListAccountsResponseObject, error) { +func (u *Unimplemented) ListTeamAccounts(ctx context.Context, request ListTeamAccountsRequestObject) (ListTeamAccountsResponseObject, error) { return nil, errors.New("not implemented") } diff --git a/pkg/apis/client.gen.go b/pkg/apis/client.gen.go index 1883bd65..fcbdea8c 100644 --- a/pkg/apis/client.gen.go +++ b/pkg/apis/client.gen.go @@ -98,6 +98,31 @@ type ClientInterface interface { CreateOperator(ctx context.Context, body CreateOperatorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeleteOperator request + DeleteOperator(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetOperator request + GetOperator(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateOperatorWithBody request with any body + UpdateOperatorWithBody(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateOperator(ctx context.Context, operatorId OperatorId, body UpdateOperatorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListOperatorAccounts request + ListOperatorAccounts(ctx context.Context, operatorId OperatorId, params *ListOperatorAccountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateOperatorAccountWithBody request with any body + CreateOperatorAccountWithBody(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateOperatorAccount(ctx context.Context, operatorId OperatorId, body CreateOperatorAccountJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListOperatorSigningKeys request + ListOperatorSigningKeys(ctx context.Context, operatorId OperatorId, params *ListOperatorSigningKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateOperatorSigningKey request + CreateOperatorSigningKey(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListSystems request ListSystems(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -125,8 +150,8 @@ type ClientInterface interface { // GetTeam request GetTeam(ctx context.Context, teamId TeamId, reqEditors ...RequestEditorFn) (*http.Response, error) - // ListAccounts request - ListAccounts(ctx context.Context, teamId TeamId, params *ListAccountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListTeamAccounts request + ListTeamAccounts(ctx context.Context, teamId TeamId, params *ListTeamAccountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetAccount request GetAccount(ctx context.Context, teamId openapi_types.UUID, accountId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -203,6 +228,114 @@ func (c *Client) CreateOperator(ctx context.Context, body CreateOperatorJSONRequ return c.Client.Do(req) } +func (c *Client) DeleteOperator(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteOperatorRequest(c.Server, operatorId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetOperator(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetOperatorRequest(c.Server, operatorId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateOperatorWithBody(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateOperatorRequestWithBody(c.Server, operatorId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateOperator(ctx context.Context, operatorId OperatorId, body UpdateOperatorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateOperatorRequest(c.Server, operatorId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ListOperatorAccounts(ctx context.Context, operatorId OperatorId, params *ListOperatorAccountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListOperatorAccountsRequest(c.Server, operatorId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateOperatorAccountWithBody(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateOperatorAccountRequestWithBody(c.Server, operatorId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateOperatorAccount(ctx context.Context, operatorId OperatorId, body CreateOperatorAccountJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateOperatorAccountRequest(c.Server, operatorId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ListOperatorSigningKeys(ctx context.Context, operatorId OperatorId, params *ListOperatorSigningKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListOperatorSigningKeysRequest(c.Server, operatorId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateOperatorSigningKey(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateOperatorSigningKeyRequest(c.Server, operatorId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) ListSystems(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListSystemsRequest(c.Server) if err != nil { @@ -323,8 +456,8 @@ func (c *Client) GetTeam(ctx context.Context, teamId TeamId, reqEditors ...Reque return c.Client.Do(req) } -func (c *Client) ListAccounts(ctx context.Context, teamId TeamId, params *ListAccountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAccountsRequest(c.Server, teamId, params) +func (c *Client) ListTeamAccounts(ctx context.Context, teamId TeamId, params *ListTeamAccountsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListTeamAccountsRequest(c.Server, teamId, params) if err != nil { return nil, err } @@ -608,54 +741,23 @@ func NewCreateOperatorRequestWithBody(server string, contentType string, body io return req, nil } -// NewListSystemsRequest generates requests for ListSystems -func NewListSystemsRequest(server string) (*http.Request, error) { +// NewDeleteOperatorRequest generates requests for DeleteOperator +func NewDeleteOperatorRequest(server string, operatorId OperatorId) (*http.Request, error) { var err error - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/systems") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} + var pathParam0 string -// NewCreateSystemRequest calls the generic CreateSystem builder with application/json body -func NewCreateSystemRequest(server string, body CreateSystemJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "operatorId", runtime.ParamLocationPath, operatorId) if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewCreateSystemRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateSystemRequestWithBody generates requests for CreateSystem with any type of body -func NewCreateSystemRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/systems") + operationPath := fmt.Sprintf("/operators/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -665,23 +767,21 @@ func NewCreateSystemRequestWithBody(server string, contentType string, body io.R return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - return req, nil } -// NewGetSystemRequest generates requests for GetSystem -func NewGetSystemRequest(server string, systemId string) (*http.Request, error) { +// NewGetOperatorRequest generates requests for GetOperator +func NewGetOperatorRequest(server string, operatorId OperatorId) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "systemId", runtime.ParamLocationPath, systemId) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "operatorId", runtime.ParamLocationPath, operatorId) if err != nil { return nil, err } @@ -691,7 +791,7 @@ func NewGetSystemRequest(server string, systemId string) (*http.Request, error) return nil, err } - operationPath := fmt.Sprintf("/systems/%s", pathParam0) + operationPath := fmt.Sprintf("/operators/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -709,24 +809,24 @@ func NewGetSystemRequest(server string, systemId string) (*http.Request, error) return req, nil } -// NewUpdateSystemRequest calls the generic UpdateSystem builder with application/json body -func NewUpdateSystemRequest(server string, systemId string, body UpdateSystemJSONRequestBody) (*http.Request, error) { +// NewUpdateOperatorRequest calls the generic UpdateOperator builder with application/json body +func NewUpdateOperatorRequest(server string, operatorId OperatorId, body UpdateOperatorJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewUpdateSystemRequestWithBody(server, systemId, "application/json", bodyReader) + return NewUpdateOperatorRequestWithBody(server, operatorId, "application/json", bodyReader) } -// NewUpdateSystemRequestWithBody generates requests for UpdateSystem with any type of body -func NewUpdateSystemRequestWithBody(server string, systemId string, contentType string, body io.Reader) (*http.Request, error) { +// NewUpdateOperatorRequestWithBody generates requests for UpdateOperator with any type of body +func NewUpdateOperatorRequestWithBody(server string, operatorId OperatorId, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "systemId", runtime.ParamLocationPath, systemId) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "operatorId", runtime.ParamLocationPath, operatorId) if err != nil { return nil, err } @@ -736,7 +836,7 @@ func NewUpdateSystemRequestWithBody(server string, systemId string, contentType return nil, err } - operationPath := fmt.Sprintf("/systems/%s", pathParam0) + operationPath := fmt.Sprintf("/operators/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -756,16 +856,23 @@ func NewUpdateSystemRequestWithBody(server string, systemId string, contentType return req, nil } -// NewListTeamsRequest generates requests for ListTeams -func NewListTeamsRequest(server string, params *ListTeamsParams) (*http.Request, error) { +// NewListOperatorAccountsRequest generates requests for ListOperatorAccounts +func NewListOperatorAccountsRequest(server string, operatorId OperatorId, params *ListOperatorAccountsParams) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "operatorId", runtime.ParamLocationPath, operatorId) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/teams") + operationPath := fmt.Sprintf("/operators/%s/accounts", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -821,53 +928,24 @@ func NewListTeamsRequest(server string, params *ListTeamsParams) (*http.Request, return req, nil } -// NewCreateTeamRequest calls the generic CreateTeam builder with application/json body -func NewCreateTeamRequest(server string, body CreateTeamJSONRequestBody) (*http.Request, error) { +// NewCreateOperatorAccountRequest calls the generic CreateOperatorAccount builder with application/json body +func NewCreateOperatorAccountRequest(server string, operatorId OperatorId, body CreateOperatorAccountJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewCreateTeamRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateTeamRequestWithBody generates requests for CreateTeam with any type of body -func NewCreateTeamRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/teams") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil + return NewCreateOperatorAccountRequestWithBody(server, operatorId, "application/json", bodyReader) } -// NewGetTeamRequest generates requests for GetTeam -func NewGetTeamRequest(server string, teamId TeamId) (*http.Request, error) { +// NewCreateOperatorAccountRequestWithBody generates requests for CreateOperatorAccount with any type of body +func NewCreateOperatorAccountRequestWithBody(server string, operatorId OperatorId, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "operatorId", runtime.ParamLocationPath, operatorId) if err != nil { return nil, err } @@ -877,7 +955,7 @@ func NewGetTeamRequest(server string, teamId TeamId) (*http.Request, error) { return nil, err } - operationPath := fmt.Sprintf("/teams/%s", pathParam0) + operationPath := fmt.Sprintf("/operators/%s/accounts", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -887,21 +965,23 @@ func NewGetTeamRequest(server string, teamId TeamId) (*http.Request, error) { return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewListAccountsRequest generates requests for ListAccounts -func NewListAccountsRequest(server string, teamId TeamId, params *ListAccountsParams) (*http.Request, error) { +// NewListOperatorSigningKeysRequest generates requests for ListOperatorSigningKeys +func NewListOperatorSigningKeysRequest(server string, operatorId OperatorId, params *ListOperatorSigningKeysParams) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "operatorId", runtime.ParamLocationPath, operatorId) if err != nil { return nil, err } @@ -911,7 +991,7 @@ func NewListAccountsRequest(server string, teamId TeamId, params *ListAccountsPa return nil, err } - operationPath := fmt.Sprintf("/teams/%s/accounts", pathParam0) + operationPath := fmt.Sprintf("/operators/%s/signing-keys", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -967,20 +1047,13 @@ func NewListAccountsRequest(server string, teamId TeamId, params *ListAccountsPa return req, nil } -// NewGetAccountRequest generates requests for GetAccount -func NewGetAccountRequest(server string, teamId openapi_types.UUID, accountId openapi_types.UUID) (*http.Request, error) { +// NewCreateOperatorSigningKeyRequest generates requests for CreateOperatorSigningKey +func NewCreateOperatorSigningKeyRequest(server string, operatorId OperatorId) (*http.Request, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "accountId", runtime.ParamLocationPath, accountId) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "operatorId", runtime.ParamLocationPath, operatorId) if err != nil { return nil, err } @@ -990,7 +1063,7 @@ func NewGetAccountRequest(server string, teamId openapi_types.UUID, accountId op return nil, err } - operationPath := fmt.Sprintf("/teams/%s/accounts/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/operators/%s/signing-keys", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -1000,7 +1073,7 @@ func NewGetAccountRequest(server string, teamId openapi_types.UUID, accountId op return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), nil) if err != nil { return nil, err } @@ -1008,30 +1081,54 @@ func NewGetAccountRequest(server string, teamId openapi_types.UUID, accountId op return req, nil } -// NewListGroupsRequest generates requests for ListGroups -func NewListGroupsRequest(server string, teamId TeamId, accountId AccountId, params *ListGroupsParams) (*http.Request, error) { +// NewListSystemsRequest generates requests for ListSystems +func NewListSystemsRequest(server string) (*http.Request, error) { var err error - var pathParam0 string + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) + operationPath := fmt.Sprintf("/systems") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - var pathParam1 string + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "accountId", runtime.ParamLocationPath, accountId) + return req, nil +} + +// NewCreateSystemRequest calls the generic CreateSystem builder with application/json body +func NewCreateSystemRequest(server string, body CreateSystemJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) + return NewCreateSystemRequestWithBody(server, "application/json", bodyReader) +} + +// NewCreateSystemRequestWithBody generates requests for CreateSystem with any type of body +func NewCreateSystemRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/teams/%s/accounts/%s/groups", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/systems") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -1041,11 +1138,387 @@ func NewListGroupsRequest(server string, teamId TeamId, accountId AccountId, par return nil, err } - if params != nil { - queryValues := queryURL.Query() - - if params.Offset != nil { - + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetSystemRequest generates requests for GetSystem +func NewGetSystemRequest(server string, systemId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "systemId", runtime.ParamLocationPath, systemId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/systems/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUpdateSystemRequest calls the generic UpdateSystem builder with application/json body +func NewUpdateSystemRequest(server string, systemId string, body UpdateSystemJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateSystemRequestWithBody(server, systemId, "application/json", bodyReader) +} + +// NewUpdateSystemRequestWithBody generates requests for UpdateSystem with any type of body +func NewUpdateSystemRequestWithBody(server string, systemId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "systemId", runtime.ParamLocationPath, systemId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/systems/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PUT", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewListTeamsRequest generates requests for ListTeams +func NewListTeamsRequest(server string, params *ListTeamsParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Offset != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewCreateTeamRequest calls the generic CreateTeam builder with application/json body +func NewCreateTeamRequest(server string, body CreateTeamJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateTeamRequestWithBody(server, "application/json", bodyReader) +} + +// NewCreateTeamRequestWithBody generates requests for CreateTeam with any type of body +func NewCreateTeamRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetTeamRequest generates requests for GetTeam +func NewGetTeamRequest(server string, teamId TeamId) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListTeamAccountsRequest generates requests for ListTeamAccounts +func NewListTeamAccountsRequest(server string, teamId TeamId, params *ListTeamAccountsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/accounts", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Offset != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetAccountRequest generates requests for GetAccount +func NewGetAccountRequest(server string, teamId openapi_types.UUID, accountId openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "accountId", runtime.ParamLocationPath, accountId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/accounts/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListGroupsRequest generates requests for ListGroups +func NewListGroupsRequest(server string, teamId TeamId, accountId AccountId, params *ListGroupsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "teamId", runtime.ParamLocationPath, teamId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "accountId", runtime.ParamLocationPath, accountId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/accounts/%s/groups", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Offset != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { @@ -1570,6 +2043,31 @@ type ClientWithResponsesInterface interface { CreateOperatorWithResponse(ctx context.Context, body CreateOperatorJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateOperatorResponse, error) + // DeleteOperatorWithResponse request + DeleteOperatorWithResponse(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*DeleteOperatorResponse, error) + + // GetOperatorWithResponse request + GetOperatorWithResponse(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*GetOperatorResponse, error) + + // UpdateOperatorWithBodyWithResponse request with any body + UpdateOperatorWithBodyWithResponse(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateOperatorResponse, error) + + UpdateOperatorWithResponse(ctx context.Context, operatorId OperatorId, body UpdateOperatorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateOperatorResponse, error) + + // ListOperatorAccountsWithResponse request + ListOperatorAccountsWithResponse(ctx context.Context, operatorId OperatorId, params *ListOperatorAccountsParams, reqEditors ...RequestEditorFn) (*ListOperatorAccountsResponse, error) + + // CreateOperatorAccountWithBodyWithResponse request with any body + CreateOperatorAccountWithBodyWithResponse(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateOperatorAccountResponse, error) + + CreateOperatorAccountWithResponse(ctx context.Context, operatorId OperatorId, body CreateOperatorAccountJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateOperatorAccountResponse, error) + + // ListOperatorSigningKeysWithResponse request + ListOperatorSigningKeysWithResponse(ctx context.Context, operatorId OperatorId, params *ListOperatorSigningKeysParams, reqEditors ...RequestEditorFn) (*ListOperatorSigningKeysResponse, error) + + // CreateOperatorSigningKeyWithResponse request + CreateOperatorSigningKeyWithResponse(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*CreateOperatorSigningKeyResponse, error) + // ListSystemsWithResponse request ListSystemsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSystemsResponse, error) @@ -1597,8 +2095,8 @@ type ClientWithResponsesInterface interface { // GetTeamWithResponse request GetTeamWithResponse(ctx context.Context, teamId TeamId, reqEditors ...RequestEditorFn) (*GetTeamResponse, error) - // ListAccountsWithResponse request - ListAccountsWithResponse(ctx context.Context, teamId TeamId, params *ListAccountsParams, reqEditors ...RequestEditorFn) (*ListAccountsResponse, error) + // ListTeamAccountsWithResponse request + ListTeamAccountsWithResponse(ctx context.Context, teamId TeamId, params *ListTeamAccountsParams, reqEditors ...RequestEditorFn) (*ListTeamAccountsResponse, error) // GetAccountWithResponse request GetAccountWithResponse(ctx context.Context, teamId openapi_types.UUID, accountId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetAccountResponse, error) @@ -1625,33 +2123,196 @@ type ClientWithResponsesInterface interface { // CreateUserWithBodyWithResponse request with any body CreateUserWithBodyWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) - CreateUserWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) + CreateUserWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) + + // GetUserWithResponse request + GetUserWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, userId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetUserResponse, error) + + // UpdateUserWithBodyWithResponse request with any body + UpdateUserWithBodyWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, userId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error) + + UpdateUserWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, userId openapi_types.UUID, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error) + + // VersionWithResponse request + VersionWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*VersionResponse, error) +} + +type ListOperatorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Limit *float32 `json:"limit,omitempty"` + Offset *float32 `json:"offset,omitempty"` + Results *[]Operator `json:"results,omitempty"` + Total *float32 `json:"total,omitempty"` + } +} + +// Status returns HTTPResponse.Status +func (r ListOperatorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListOperatorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type CreateOperatorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *Operator +} + +// Status returns HTTPResponse.Status +func (r CreateOperatorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CreateOperatorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteOperatorResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r DeleteOperatorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteOperatorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetOperatorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *Operator +} + +// Status returns HTTPResponse.Status +func (r GetOperatorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetOperatorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type UpdateOperatorResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *Operator +} + +// Status returns HTTPResponse.Status +func (r UpdateOperatorResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateOperatorResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type ListOperatorAccountsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Limit *float32 `json:"limit,omitempty"` + Offset *float32 `json:"offset,omitempty"` + Results *[]Account `json:"results,omitempty"` + Total *float32 `json:"total,omitempty"` + } +} + +// Status returns HTTPResponse.Status +func (r ListOperatorAccountsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // GetUserWithResponse request - GetUserWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, userId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetUserResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r ListOperatorAccountsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} - // UpdateUserWithBodyWithResponse request with any body - UpdateUserWithBodyWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, userId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error) +type CreateOperatorAccountResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *Account +} - UpdateUserWithResponse(ctx context.Context, teamId TeamId, accountId AccountId, userId openapi_types.UUID, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateUserResponse, error) +// Status returns HTTPResponse.Status +func (r CreateOperatorAccountResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} - // VersionWithResponse request - VersionWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*VersionResponse, error) +// StatusCode returns HTTPResponse.StatusCode +func (r CreateOperatorAccountResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 } -type ListOperatorResponse struct { +type ListOperatorSigningKeysResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { - Limit *float32 `json:"limit,omitempty"` - Offset *float32 `json:"offset,omitempty"` - Results *[]Operator `json:"results,omitempty"` - Total *float32 `json:"total,omitempty"` + Limit *float32 `json:"limit,omitempty"` + Offset *float32 `json:"offset,omitempty"` + Results *[]KeyPair `json:"results,omitempty"` + Total *float32 `json:"total,omitempty"` } } // Status returns HTTPResponse.Status -func (r ListOperatorResponse) Status() string { +func (r ListOperatorSigningKeysResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1659,21 +2320,21 @@ func (r ListOperatorResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListOperatorResponse) StatusCode() int { +func (r ListOperatorSigningKeysResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type CreateOperatorResponse struct { +type CreateOperatorSigningKeyResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *Operator + JSON201 *KeyPair } // Status returns HTTPResponse.Status -func (r CreateOperatorResponse) Status() string { +func (r CreateOperatorSigningKeyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1681,7 +2342,7 @@ func (r CreateOperatorResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateOperatorResponse) StatusCode() int { +func (r CreateOperatorSigningKeyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -1851,7 +2512,7 @@ func (r GetTeamResponse) StatusCode() int { return 0 } -type ListAccountsResponse struct { +type ListTeamAccountsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { @@ -1863,7 +2524,7 @@ type ListAccountsResponse struct { } // Status returns HTTPResponse.Status -func (r ListAccountsResponse) Status() string { +func (r ListTeamAccountsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1871,7 +2532,7 @@ func (r ListAccountsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListAccountsResponse) StatusCode() int { +func (r ListTeamAccountsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -2134,6 +2795,85 @@ func (c *ClientWithResponses) CreateOperatorWithResponse(ctx context.Context, bo return ParseCreateOperatorResponse(rsp) } +// DeleteOperatorWithResponse request returning *DeleteOperatorResponse +func (c *ClientWithResponses) DeleteOperatorWithResponse(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*DeleteOperatorResponse, error) { + rsp, err := c.DeleteOperator(ctx, operatorId, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteOperatorResponse(rsp) +} + +// GetOperatorWithResponse request returning *GetOperatorResponse +func (c *ClientWithResponses) GetOperatorWithResponse(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*GetOperatorResponse, error) { + rsp, err := c.GetOperator(ctx, operatorId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetOperatorResponse(rsp) +} + +// UpdateOperatorWithBodyWithResponse request with arbitrary body returning *UpdateOperatorResponse +func (c *ClientWithResponses) UpdateOperatorWithBodyWithResponse(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateOperatorResponse, error) { + rsp, err := c.UpdateOperatorWithBody(ctx, operatorId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateOperatorResponse(rsp) +} + +func (c *ClientWithResponses) UpdateOperatorWithResponse(ctx context.Context, operatorId OperatorId, body UpdateOperatorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateOperatorResponse, error) { + rsp, err := c.UpdateOperator(ctx, operatorId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateOperatorResponse(rsp) +} + +// ListOperatorAccountsWithResponse request returning *ListOperatorAccountsResponse +func (c *ClientWithResponses) ListOperatorAccountsWithResponse(ctx context.Context, operatorId OperatorId, params *ListOperatorAccountsParams, reqEditors ...RequestEditorFn) (*ListOperatorAccountsResponse, error) { + rsp, err := c.ListOperatorAccounts(ctx, operatorId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListOperatorAccountsResponse(rsp) +} + +// CreateOperatorAccountWithBodyWithResponse request with arbitrary body returning *CreateOperatorAccountResponse +func (c *ClientWithResponses) CreateOperatorAccountWithBodyWithResponse(ctx context.Context, operatorId OperatorId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateOperatorAccountResponse, error) { + rsp, err := c.CreateOperatorAccountWithBody(ctx, operatorId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateOperatorAccountResponse(rsp) +} + +func (c *ClientWithResponses) CreateOperatorAccountWithResponse(ctx context.Context, operatorId OperatorId, body CreateOperatorAccountJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateOperatorAccountResponse, error) { + rsp, err := c.CreateOperatorAccount(ctx, operatorId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateOperatorAccountResponse(rsp) +} + +// ListOperatorSigningKeysWithResponse request returning *ListOperatorSigningKeysResponse +func (c *ClientWithResponses) ListOperatorSigningKeysWithResponse(ctx context.Context, operatorId OperatorId, params *ListOperatorSigningKeysParams, reqEditors ...RequestEditorFn) (*ListOperatorSigningKeysResponse, error) { + rsp, err := c.ListOperatorSigningKeys(ctx, operatorId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListOperatorSigningKeysResponse(rsp) +} + +// CreateOperatorSigningKeyWithResponse request returning *CreateOperatorSigningKeyResponse +func (c *ClientWithResponses) CreateOperatorSigningKeyWithResponse(ctx context.Context, operatorId OperatorId, reqEditors ...RequestEditorFn) (*CreateOperatorSigningKeyResponse, error) { + rsp, err := c.CreateOperatorSigningKey(ctx, operatorId, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateOperatorSigningKeyResponse(rsp) +} + // ListSystemsWithResponse request returning *ListSystemsResponse func (c *ClientWithResponses) ListSystemsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSystemsResponse, error) { rsp, err := c.ListSystems(ctx, reqEditors...) @@ -2221,13 +2961,13 @@ func (c *ClientWithResponses) GetTeamWithResponse(ctx context.Context, teamId Te return ParseGetTeamResponse(rsp) } -// ListAccountsWithResponse request returning *ListAccountsResponse -func (c *ClientWithResponses) ListAccountsWithResponse(ctx context.Context, teamId TeamId, params *ListAccountsParams, reqEditors ...RequestEditorFn) (*ListAccountsResponse, error) { - rsp, err := c.ListAccounts(ctx, teamId, params, reqEditors...) +// ListTeamAccountsWithResponse request returning *ListTeamAccountsResponse +func (c *ClientWithResponses) ListTeamAccountsWithResponse(ctx context.Context, teamId TeamId, params *ListTeamAccountsParams, reqEditors ...RequestEditorFn) (*ListTeamAccountsResponse, error) { + rsp, err := c.ListTeamAccounts(ctx, teamId, params, reqEditors...) if err != nil { return nil, err } - return ParseListAccountsResponse(rsp) + return ParseListTeamAccountsResponse(rsp) } // GetAccountWithResponse request returning *GetAccountResponse @@ -2409,6 +3149,188 @@ func ParseCreateOperatorResponse(rsp *http.Response) (*CreateOperatorResponse, e return response, nil } +// ParseDeleteOperatorResponse parses an HTTP response from a DeleteOperatorWithResponse call +func ParseDeleteOperatorResponse(rsp *http.Response) (*DeleteOperatorResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeleteOperatorResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseGetOperatorResponse parses an HTTP response from a GetOperatorWithResponse call +func ParseGetOperatorResponse(rsp *http.Response) (*GetOperatorResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetOperatorResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Operator + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseUpdateOperatorResponse parses an HTTP response from a UpdateOperatorWithResponse call +func ParseUpdateOperatorResponse(rsp *http.Response) (*UpdateOperatorResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpdateOperatorResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Operator + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseListOperatorAccountsResponse parses an HTTP response from a ListOperatorAccountsWithResponse call +func ParseListOperatorAccountsResponse(rsp *http.Response) (*ListOperatorAccountsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListOperatorAccountsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Limit *float32 `json:"limit,omitempty"` + Offset *float32 `json:"offset,omitempty"` + Results *[]Account `json:"results,omitempty"` + Total *float32 `json:"total,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseCreateOperatorAccountResponse parses an HTTP response from a CreateOperatorAccountWithResponse call +func ParseCreateOperatorAccountResponse(rsp *http.Response) (*CreateOperatorAccountResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &CreateOperatorAccountResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest Account + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + } + + return response, nil +} + +// ParseListOperatorSigningKeysResponse parses an HTTP response from a ListOperatorSigningKeysWithResponse call +func ParseListOperatorSigningKeysResponse(rsp *http.Response) (*ListOperatorSigningKeysResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListOperatorSigningKeysResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Limit *float32 `json:"limit,omitempty"` + Offset *float32 `json:"offset,omitempty"` + Results *[]KeyPair `json:"results,omitempty"` + Total *float32 `json:"total,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseCreateOperatorSigningKeyResponse parses an HTTP response from a CreateOperatorSigningKeyWithResponse call +func ParseCreateOperatorSigningKeyResponse(rsp *http.Response) (*CreateOperatorSigningKeyResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &CreateOperatorSigningKeyResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest KeyPair + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + } + + return response, nil +} + // ParseListSystemsResponse parses an HTTP response from a ListSystemsWithResponse call func ParseListSystemsResponse(rsp *http.Response) (*ListSystemsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -2591,15 +3513,15 @@ func ParseGetTeamResponse(rsp *http.Response) (*GetTeamResponse, error) { return response, nil } -// ParseListAccountsResponse parses an HTTP response from a ListAccountsWithResponse call -func ParseListAccountsResponse(rsp *http.Response) (*ListAccountsResponse, error) { +// ParseListTeamAccountsResponse parses an HTTP response from a ListTeamAccountsWithResponse call +func ParseListTeamAccountsResponse(rsp *http.Response) (*ListTeamAccountsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListAccountsResponse{ + response := &ListTeamAccountsResponse{ Body: bodyBytes, HTTPResponse: rsp, } diff --git a/pkg/apis/models.gen.go b/pkg/apis/models.gen.go index 33f0f65a..8a25eec3 100644 --- a/pkg/apis/models.gen.go +++ b/pkg/apis/models.gen.go @@ -34,7 +34,9 @@ type Account struct { DeletedAt *time.Time `json:"deletedAt,omitempty"` Description *string `json:"description,omitempty"` Id *openapi_types.UUID `json:"id,omitempty"` + Key *KeyPair `json:"key,omitempty"` Name string `json:"name"` + SigningKeys *[]KeyPair `json:"signingKeys,omitempty"` // UpdatedAt Creation date and time UpdatedAt *time.Time `json:"updatedAt,omitempty"` @@ -63,12 +65,12 @@ type Operator struct { CreatedAt *time.Time `json:"createdAt,omitempty"` // DeletedAt Creation date and time - DeletedAt *time.Time `json:"deletedAt,omitempty"` - Description *string `json:"description,omitempty"` - Id *string `json:"id,omitempty"` - Key *KeyPair `json:"key,omitempty"` - Name string `json:"name"` - SigningKeys *[]KeyPair `json:"signingKeys,omitempty"` + DeletedAt *time.Time `json:"deletedAt,omitempty"` + Description *string `json:"description,omitempty"` + Id *openapi_types.UUID `json:"id,omitempty"` + Key *KeyPair `json:"key,omitempty"` + Name string `json:"name"` + SigningKeys *[]KeyPair `json:"signingKeys,omitempty"` // UpdatedAt Creation date and time UpdatedAt *time.Time `json:"updatedAt,omitempty"` @@ -198,9 +200,18 @@ type LimitParam = int // OffsetParam defines model for offsetParam. type OffsetParam = int +// OperatorId defines model for operatorId. +type OperatorId = openapi_types.UUID + // TeamId defines model for teamId. type TeamId = openapi_types.UUID +// CreateAccount defines model for CreateAccount. +type CreateAccount struct { + Description *string `json:"description,omitempty"` + Name string `json:"name"` +} + // CreateOperator defines model for CreateOperator. type CreateOperator struct { ContactEmail *string `json:"contactEmail,omitempty"` @@ -227,6 +238,30 @@ type CreateOperatorJSONBody struct { Name string `json:"name"` } +// ListOperatorAccountsParams defines parameters for ListOperatorAccounts. +type ListOperatorAccountsParams struct { + // Offset The number of items to skip before starting to collect the result set. + Offset *OffsetParam `form:"offset,omitempty" json:"offset,omitempty"` + + // Limit The numbers of items to return. + Limit *LimitParam `form:"limit,omitempty" json:"limit,omitempty"` +} + +// CreateOperatorAccountJSONBody defines parameters for CreateOperatorAccount. +type CreateOperatorAccountJSONBody struct { + Description *string `json:"description,omitempty"` + Name string `json:"name"` +} + +// ListOperatorSigningKeysParams defines parameters for ListOperatorSigningKeys. +type ListOperatorSigningKeysParams struct { + // Offset The number of items to skip before starting to collect the result set. + Offset *OffsetParam `form:"offset,omitempty" json:"offset,omitempty"` + + // Limit The numbers of items to return. + Limit *LimitParam `form:"limit,omitempty" json:"limit,omitempty"` +} + // ListTeamsParams defines parameters for ListTeams. type ListTeamsParams struct { // Offset The number of items to skip before starting to collect the result set. @@ -236,8 +271,8 @@ type ListTeamsParams struct { Limit *LimitParam `form:"limit,omitempty" json:"limit,omitempty"` } -// ListAccountsParams defines parameters for ListAccounts. -type ListAccountsParams struct { +// ListTeamAccountsParams defines parameters for ListTeamAccounts. +type ListTeamAccountsParams struct { // Offset The number of items to skip before starting to collect the result set. Offset *OffsetParam `form:"offset,omitempty" json:"offset,omitempty"` @@ -266,6 +301,12 @@ type ListUsersParams struct { // CreateOperatorJSONRequestBody defines body for CreateOperator for application/json ContentType. type CreateOperatorJSONRequestBody CreateOperatorJSONBody +// UpdateOperatorJSONRequestBody defines body for UpdateOperator for application/json ContentType. +type UpdateOperatorJSONRequestBody = Operator + +// CreateOperatorAccountJSONRequestBody defines body for CreateOperatorAccount for application/json ContentType. +type CreateOperatorAccountJSONRequestBody CreateOperatorAccountJSONBody + // CreateSystemJSONRequestBody defines body for CreateSystem for application/json ContentType. type CreateSystemJSONRequestBody = System @@ -290,47 +331,50 @@ type UpdateUserJSONRequestBody = User // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xcW2/bOBb+KwQ7j4qlpLtA4bdM2w0yHbRBnc4CmxoDWjq22UqkhqSSMQz/9wVvuliS", - "b4ndy+RRInl47vp4eOwljnmWcwZMSTxc4pwIkoECYZ5IHPOCqetEPyQgY0FzRTnDQ3w7B0QTxKdIzQG5", - "iUhxJEAJCvcwwAGmemZO1BwHmJEM8LBGMsAC/iqogAQPlSggwDKeQ0b0XlMuMqLwEBcF1TPVIteLpRKU", - "zfBqFeCZ4EW+nTEzbQe2PLnHMZXSjKobrcJuvliRTUBIzRxVkEnHWCFYydZfBYhFxZehiOtcJDAlRarw", - "8CIKcEb+plmR4eG/9QNl9uG85I0yBTMQhjk+nUrYzl2DOfmV5mgCUy4ASUWEomym38c8TSFWRsUCZJEq", - "JEH1CWF37paiznfUybcCkm03tJ61g50dsceYeWUXg1S/8oSCCZTXAoiCDzkIorjQb2LOFDBloijPUxoT", - "zXb4RWrel7XtcsFzEMoR0stIrN5mhKb6eW3zoKmDjnEr57LDOSuJ7+yscSkbn3yBWGnZVoGT5Rasm+ws", - "xy8CpniIX4RVQgntqAwNsZUl797pJZc2FxyghdjwmFyqtlsY9ilnKCEKEGEJUjQDHGD4m2R5qulcRBfn", - "Z9H52cvoNno1fBkNo+h/OKgMr1eeuVUdBkjhm2292fY06fJfAST5wNKF9/RdXSbARZ58Gy3v5q0Bfp0W", - "UoFoO9CBmihEenDsBPgdLG4IFU1l4SG+RG4EUYkIyotJSuMwF/Re6+4rLFBOqBh8ZjhYE8PNeQeLhjgT", - "IuHlRZeHWNq7zl8TrFrcJd17R7XpB5cM6QEtmc7CdaH4FBH0/vJ25NGBlXAHKep59DkxPH1iKDW/NSC+", - "Wptvyu3e6zclEklnjLLZO1jY6NTwYg+6jh4Rgix+iLx0Q2aUaRY/GmzU9mML6ypVWeiFS5TWOWSBlqyN", - "lRpRXJG0Y9Gqg7lRaYwrDXo7guw5hrqAF5VkkkLSQK9Tksoqbiacp0DYIz7FVP4pY57vukt/wGki2yJs", - "zRFGZs2PEF6djLfcOCGqddRYP14EOCeLlJNkh4n66yjnhyj1xi3VhikmWp+Tg4wzKhdXlIxl5Db2Vztq", - "8aYSsqlMkqb8oZG7Wz63npMSYIt9VuzK46iuwu+Dy4VUkHUk0gqebjK1R7HP8MWm3jWEiWrP/rQvjcYH", - "XcQeeQhqbv6eZNDcsyE1FGcPINXZeRcjvIZiN5m/RLvfW+oNSgce9zr97njOBcnKFK2u7YrzKGpHpK88", - "PCP/55LA/tjgk+yqB/wznQN6g+VAt/jyoDrJuWPiT+RGf4CQLqZaqLJbpPtqxeY9/cTA0uqowgZYQlwI", - "qhYjnTwdtsnpn07Ppq49B5KAqF2suPEqoeb0HZiMOgEiQFwWygA7+/Qfr6zf/nvrK/PmdGFGKypzpXKT", - "Xjn/SsHTMBzYVxUHv43ejkbXH95fv2kzsTIkmCyMNHftWvJYR8qUMlri2VqhOC5L0h9B5pxJ6Cv57VEP", - "b9W+A0zZlLc98gW6ZkrwpIj1i8/sM7td5HPOmannMQT3wBSaCJrMAE25QDXhpPFgCeKexiBtBSylMTgR", - "nOYucxLPAV0MIuyKkEbvchiGDw8PA2KGB1zMQrdWhr9fv377fvT27GIQDeYqSw1SpcrEh2fv8uYa1xwT", - "nw+iQeSgCSM5xUP8cnBuNs2Jmhs1hh62mKeZLUXYd5Sz6wQP8e9UqhK0BI0rw7tuDFBNCeu3UKtg6/Ta", - "jdpqbMqjSRH3u5Bw7mGYv4iivW4wSJp+mPbK4HHMem1HC9H0xFqdZidkVAeA2w4bY+OnTf8cFXEMUk6L", - "NEVeAY0sYmSqJ4E7k+qHlanHWrmyyDIiFs7CiKQpqmYEWJGZ0XvJ7lifirlUtqDFvhpBr6D0jV8X9tqu", - "6T0z6HOeZQmZzcRfvCyDCU8WL0Ka2CBtklu7edvFRfzdXW9ps3G9F67tsGp52fmT3ZNVm7StbNlIrGFL", - "S9m3EhHE4KE0V7e1VgEOZYXaXWw3d/lobqM1vVT7AJ+ijDAyg8Qdf6Q+c7XTgT8M/KARWJ1Nnjb+2gHV", - "oU1vKcdEX1TZ4d6YGvnTaTOi7D57x1NFbb9oepIo8NZwV+1HirVql0MirSwGtKxXi7Jw6dW/spFmTgJt", - "89mBTgvebe56sPSR4sjS6G56KJ1gU9vDOkBqf03/1U4XleuvaeuNYUdry7E4WaDrNzrCnirtXPX4/M4a", - "850iR9VZ1FXQyn0CK9OFuSxNUy/twdlD2vRRdKC2T+bI9TiV2WPbUyvstBkkOkEG6Q0La4R2WOikoYBk", - "m0H3rZnxjLgf/b23/UgnRtvWvn1IWznb+ng2LPZhAT3YiwTMynUc4Jvo9kIBntJxELU3wtG+8L7r7JDv", - "u7Kir1mjDNNwaRW66o3Xq05DbI9WZ6jV+IiJq08xvWnrCpRWjOmxXM9YpSpC1+azOYdd+kmHKiZ4Tnj7", - "JzzfaXnqnFe6RF/a8xNs3WznsCt9LVyWDeUbY9EroOV1x+kRDpbH630/ZmYo/WTv5MDK3wBsTxB1o4Wm", - "835zzriyU46XMSrDPKeXg+onay1lp04zzof6koxrPzRdqXaqTTelz+6Ku4x0vcDLyh70/4amBb7qCaH8", - "QUsXRAv6AZz38j4Q18XVkWJn/I3qReved+TCUXu7gypI60558HfPpdBw6Vxol2LTCb1i+2Tv+k9Xc1rX", - "bav81AIIP4pColP68bYDwQY9b6hBfceq/kbJ6fswaq041WfXXTNSIWHLBfInM+MZ0n2vkM70UZ0ax1m3", - "6YNxZvRA5KbF6QVuRtZDcds2YBZgzffetbcOnn4u1GYd7LhQze9xCD4rrAEOhGTGV8OlNf0ugOx09u6u", - "TTgnfdrCxGHoTbOyHbD9lAqLju762yBdU/kbUNzPov9TZrZvaN4K3NUtrNNZrXG1M9b+KPtVjyaN38L/", - "RUDJte8LUHNAcSEEMIUcv/52+vLmunEPDuIeTLfTavt3Tfr22jvb5zpegyj1pte7sXbEBmgxb8q+3DuL", - "W8z+XZfqb+AeUp5nWgY7q9HsOQzDlMcknXOphq+iV1FIchren5sPtJOu455eAiIC6vf0vklgskCuEXRQ", - "RU3Z6bSZlPnEITUnyrwqpD4NtKm5K7wttASdzTRyq5GDxPy7CLDEds+aPxvpoO+Wapj5/wAAAP//1Bhv", - "I6pGAAA=", + "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", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/pkg/apis/server.gen.go b/pkg/apis/server.gen.go index bacad461..417f8ba4 100644 --- a/pkg/apis/server.gen.go +++ b/pkg/apis/server.gen.go @@ -21,6 +21,27 @@ type ServerInterface interface { // Creates a new operator // (POST /operators) CreateOperator(c *fiber.Ctx) error + // Deletes an operator by ID + // (DELETE /operators/{operatorId}) + DeleteOperator(c *fiber.Ctx, operatorId OperatorId) error + // Gets an operator by ID + // (GET /operators/{operatorId}) + GetOperator(c *fiber.Ctx, operatorId OperatorId) error + // Updates an operator by ID + // (PUT /operators/{operatorId}) + UpdateOperator(c *fiber.Ctx, operatorId OperatorId) error + // List all accounts for an operator + // (GET /operators/{operatorId}/accounts) + ListOperatorAccounts(c *fiber.Ctx, operatorId OperatorId, params ListOperatorAccountsParams) error + // Creates a new account + // (POST /operators/{operatorId}/accounts) + CreateOperatorAccount(c *fiber.Ctx, operatorId OperatorId) error + // List all signing keys for an operator + // (GET /operators/{operatorId}/signing-keys) + ListOperatorSigningKeys(c *fiber.Ctx, operatorId OperatorId, params ListOperatorSigningKeysParams) error + // Creates a new signing key + // (POST /operators/{operatorId}/signing-keys) + CreateOperatorSigningKey(c *fiber.Ctx, operatorId OperatorId) error // List all managed systems. // (GET /systems) ListSystems(c *fiber.Ctx) error @@ -44,7 +65,7 @@ type ServerInterface interface { GetTeam(c *fiber.Ctx, teamId TeamId) error // List all accounts for a team // (GET /teams/{teamId}/accounts) - ListAccounts(c *fiber.Ctx, teamId TeamId, params ListAccountsParams) error + ListTeamAccounts(c *fiber.Ctx, teamId TeamId, params ListTeamAccountsParams) error // Gets an account by ID // (GET /teams/{teamId}/accounts/{accountId}) GetAccount(c *fiber.Ctx, teamId openapi_types.UUID, accountId openapi_types.UUID) error @@ -129,6 +150,198 @@ func (siw *ServerInterfaceWrapper) CreateOperator(c *fiber.Ctx) error { return siw.Handler.CreateOperator(c) } +// DeleteOperator operation middleware +func (siw *ServerInterfaceWrapper) DeleteOperator(c *fiber.Ctx) error { + + var err error + + // ------------- Path parameter "operatorId" ------------- + var operatorId OperatorId + + err = runtime.BindStyledParameterWithOptions("simple", "operatorId", c.Params("operatorId"), &operatorId, runtime.BindStyledParameterOptions{Explode: false, Required: true}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter operatorId: %w", err).Error()) + } + + c.Context().SetUserValue(CookieAuthScopes, []string{}) + + c.Context().SetUserValue(BearerAuthScopes, []string{}) + + c.Context().SetUserValue(Api_keyScopes, []string{}) + + return siw.Handler.DeleteOperator(c, operatorId) +} + +// GetOperator operation middleware +func (siw *ServerInterfaceWrapper) GetOperator(c *fiber.Ctx) error { + + var err error + + // ------------- Path parameter "operatorId" ------------- + var operatorId OperatorId + + err = runtime.BindStyledParameterWithOptions("simple", "operatorId", c.Params("operatorId"), &operatorId, runtime.BindStyledParameterOptions{Explode: false, Required: true}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter operatorId: %w", err).Error()) + } + + c.Context().SetUserValue(CookieAuthScopes, []string{}) + + c.Context().SetUserValue(BearerAuthScopes, []string{}) + + c.Context().SetUserValue(Api_keyScopes, []string{}) + + return siw.Handler.GetOperator(c, operatorId) +} + +// UpdateOperator operation middleware +func (siw *ServerInterfaceWrapper) UpdateOperator(c *fiber.Ctx) error { + + var err error + + // ------------- Path parameter "operatorId" ------------- + var operatorId OperatorId + + err = runtime.BindStyledParameterWithOptions("simple", "operatorId", c.Params("operatorId"), &operatorId, runtime.BindStyledParameterOptions{Explode: false, Required: true}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter operatorId: %w", err).Error()) + } + + c.Context().SetUserValue(CookieAuthScopes, []string{}) + + c.Context().SetUserValue(BearerAuthScopes, []string{}) + + c.Context().SetUserValue(Api_keyScopes, []string{}) + + return siw.Handler.UpdateOperator(c, operatorId) +} + +// ListOperatorAccounts operation middleware +func (siw *ServerInterfaceWrapper) ListOperatorAccounts(c *fiber.Ctx) error { + + var err error + + // ------------- Path parameter "operatorId" ------------- + var operatorId OperatorId + + err = runtime.BindStyledParameterWithOptions("simple", "operatorId", c.Params("operatorId"), &operatorId, runtime.BindStyledParameterOptions{Explode: false, Required: true}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter operatorId: %w", err).Error()) + } + + c.Context().SetUserValue(BearerAuthScopes, []string{"read:accounts"}) + + // Parameter object where we will unmarshal all parameters from the context + var params ListOperatorAccountsParams + + var query url.Values + query, err = url.ParseQuery(string(c.Request().URI().QueryString())) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for query string: %w", err).Error()) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", query, ¶ms.Offset) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter offset: %w", err).Error()) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", query, ¶ms.Limit) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter limit: %w", err).Error()) + } + + return siw.Handler.ListOperatorAccounts(c, operatorId, params) +} + +// CreateOperatorAccount operation middleware +func (siw *ServerInterfaceWrapper) CreateOperatorAccount(c *fiber.Ctx) error { + + var err error + + // ------------- Path parameter "operatorId" ------------- + var operatorId OperatorId + + err = runtime.BindStyledParameterWithOptions("simple", "operatorId", c.Params("operatorId"), &operatorId, runtime.BindStyledParameterOptions{Explode: false, Required: true}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter operatorId: %w", err).Error()) + } + + c.Context().SetUserValue(CookieAuthScopes, []string{}) + + c.Context().SetUserValue(BearerAuthScopes, []string{}) + + c.Context().SetUserValue(Api_keyScopes, []string{}) + + return siw.Handler.CreateOperatorAccount(c, operatorId) +} + +// ListOperatorSigningKeys operation middleware +func (siw *ServerInterfaceWrapper) ListOperatorSigningKeys(c *fiber.Ctx) error { + + var err error + + // ------------- Path parameter "operatorId" ------------- + var operatorId OperatorId + + err = runtime.BindStyledParameterWithOptions("simple", "operatorId", c.Params("operatorId"), &operatorId, runtime.BindStyledParameterOptions{Explode: false, Required: true}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter operatorId: %w", err).Error()) + } + + c.Context().SetUserValue(BearerAuthScopes, []string{"read:signing-keys"}) + + // Parameter object where we will unmarshal all parameters from the context + var params ListOperatorSigningKeysParams + + var query url.Values + query, err = url.ParseQuery(string(c.Request().URI().QueryString())) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for query string: %w", err).Error()) + } + + // ------------- Optional query parameter "offset" ------------- + + err = runtime.BindQueryParameter("form", true, false, "offset", query, ¶ms.Offset) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter offset: %w", err).Error()) + } + + // ------------- Optional query parameter "limit" ------------- + + err = runtime.BindQueryParameter("form", true, false, "limit", query, ¶ms.Limit) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter limit: %w", err).Error()) + } + + return siw.Handler.ListOperatorSigningKeys(c, operatorId, params) +} + +// CreateOperatorSigningKey operation middleware +func (siw *ServerInterfaceWrapper) CreateOperatorSigningKey(c *fiber.Ctx) error { + + var err error + + // ------------- Path parameter "operatorId" ------------- + var operatorId OperatorId + + err = runtime.BindStyledParameterWithOptions("simple", "operatorId", c.Params("operatorId"), &operatorId, runtime.BindStyledParameterOptions{Explode: false, Required: true}) + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter operatorId: %w", err).Error()) + } + + c.Context().SetUserValue(CookieAuthScopes, []string{}) + + c.Context().SetUserValue(BearerAuthScopes, []string{}) + + c.Context().SetUserValue(Api_keyScopes, []string{}) + + return siw.Handler.CreateOperatorSigningKey(c, operatorId) +} + // ListSystems operation middleware func (siw *ServerInterfaceWrapper) ListSystems(c *fiber.Ctx) error { @@ -264,8 +477,8 @@ func (siw *ServerInterfaceWrapper) GetTeam(c *fiber.Ctx) error { return siw.Handler.GetTeam(c, teamId) } -// ListAccounts operation middleware -func (siw *ServerInterfaceWrapper) ListAccounts(c *fiber.Ctx) error { +// ListTeamAccounts operation middleware +func (siw *ServerInterfaceWrapper) ListTeamAccounts(c *fiber.Ctx) error { var err error @@ -280,7 +493,7 @@ func (siw *ServerInterfaceWrapper) ListAccounts(c *fiber.Ctx) error { c.Context().SetUserValue(BearerAuthScopes, []string{"read:accounts"}) // Parameter object where we will unmarshal all parameters from the context - var params ListAccountsParams + var params ListTeamAccountsParams var query url.Values query, err = url.ParseQuery(string(c.Request().URI().QueryString())) @@ -302,7 +515,7 @@ func (siw *ServerInterfaceWrapper) ListAccounts(c *fiber.Ctx) error { return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter limit: %w", err).Error()) } - return siw.Handler.ListAccounts(c, teamId, params) + return siw.Handler.ListTeamAccounts(c, teamId, params) } // GetAccount operation middleware @@ -682,6 +895,20 @@ func RegisterHandlersWithOptions(router fiber.Router, si ServerInterface, option router.Post(options.BaseURL+"/operators", wrapper.CreateOperator) + router.Delete(options.BaseURL+"/operators/:operatorId", wrapper.DeleteOperator) + + router.Get(options.BaseURL+"/operators/:operatorId", wrapper.GetOperator) + + router.Put(options.BaseURL+"/operators/:operatorId", wrapper.UpdateOperator) + + router.Get(options.BaseURL+"/operators/:operatorId/accounts", wrapper.ListOperatorAccounts) + + router.Post(options.BaseURL+"/operators/:operatorId/accounts", wrapper.CreateOperatorAccount) + + router.Get(options.BaseURL+"/operators/:operatorId/signing-keys", wrapper.ListOperatorSigningKeys) + + router.Post(options.BaseURL+"/operators/:operatorId/signing-keys", wrapper.CreateOperatorSigningKey) + router.Get(options.BaseURL+"/systems", wrapper.ListSystems) router.Post(options.BaseURL+"/systems", wrapper.CreateSystem) @@ -696,7 +923,7 @@ func RegisterHandlersWithOptions(router fiber.Router, si ServerInterface, option router.Get(options.BaseURL+"/teams/:teamId", wrapper.GetTeam) - router.Get(options.BaseURL+"/teams/:teamId/accounts", wrapper.ListAccounts) + router.Get(options.BaseURL+"/teams/:teamId/accounts", wrapper.ListTeamAccounts) router.Get(options.BaseURL+"/teams/:teamId/accounts/:accountId", wrapper.GetAccount) @@ -759,6 +986,138 @@ func (response CreateOperator201JSONResponse) VisitCreateOperatorResponse(ctx *f return ctx.JSON(&response) } +type DeleteOperatorRequestObject struct { + OperatorId OperatorId `json:"operatorId"` +} + +type DeleteOperatorResponseObject interface { + VisitDeleteOperatorResponse(ctx *fiber.Ctx) error +} + +type DeleteOperator204Response struct { +} + +func (response DeleteOperator204Response) VisitDeleteOperatorResponse(ctx *fiber.Ctx) error { + ctx.Status(204) + return nil +} + +type GetOperatorRequestObject struct { + OperatorId OperatorId `json:"operatorId"` +} + +type GetOperatorResponseObject interface { + VisitGetOperatorResponse(ctx *fiber.Ctx) error +} + +type GetOperator200JSONResponse Operator + +func (response GetOperator200JSONResponse) VisitGetOperatorResponse(ctx *fiber.Ctx) error { + ctx.Response().Header.Set("Content-Type", "application/json") + ctx.Status(200) + + return ctx.JSON(&response) +} + +type UpdateOperatorRequestObject struct { + OperatorId OperatorId `json:"operatorId"` + Body *UpdateOperatorJSONRequestBody +} + +type UpdateOperatorResponseObject interface { + VisitUpdateOperatorResponse(ctx *fiber.Ctx) error +} + +type UpdateOperator200JSONResponse Operator + +func (response UpdateOperator200JSONResponse) VisitUpdateOperatorResponse(ctx *fiber.Ctx) error { + ctx.Response().Header.Set("Content-Type", "application/json") + ctx.Status(200) + + return ctx.JSON(&response) +} + +type ListOperatorAccountsRequestObject struct { + OperatorId OperatorId `json:"operatorId"` + Params ListOperatorAccountsParams +} + +type ListOperatorAccountsResponseObject interface { + VisitListOperatorAccountsResponse(ctx *fiber.Ctx) error +} + +type ListOperatorAccounts200JSONResponse struct { + Limit *float32 `json:"limit,omitempty"` + Offset *float32 `json:"offset,omitempty"` + Results *[]Account `json:"results,omitempty"` + Total *float32 `json:"total,omitempty"` +} + +func (response ListOperatorAccounts200JSONResponse) VisitListOperatorAccountsResponse(ctx *fiber.Ctx) error { + ctx.Response().Header.Set("Content-Type", "application/json") + ctx.Status(200) + + return ctx.JSON(&response) +} + +type CreateOperatorAccountRequestObject struct { + OperatorId OperatorId `json:"operatorId"` + Body *CreateOperatorAccountJSONRequestBody +} + +type CreateOperatorAccountResponseObject interface { + VisitCreateOperatorAccountResponse(ctx *fiber.Ctx) error +} + +type CreateOperatorAccount201JSONResponse Account + +func (response CreateOperatorAccount201JSONResponse) VisitCreateOperatorAccountResponse(ctx *fiber.Ctx) error { + ctx.Response().Header.Set("Content-Type", "application/json") + ctx.Status(201) + + return ctx.JSON(&response) +} + +type ListOperatorSigningKeysRequestObject struct { + OperatorId OperatorId `json:"operatorId"` + Params ListOperatorSigningKeysParams +} + +type ListOperatorSigningKeysResponseObject interface { + VisitListOperatorSigningKeysResponse(ctx *fiber.Ctx) error +} + +type ListOperatorSigningKeys200JSONResponse struct { + Limit *float32 `json:"limit,omitempty"` + Offset *float32 `json:"offset,omitempty"` + Results *[]KeyPair `json:"results,omitempty"` + Total *float32 `json:"total,omitempty"` +} + +func (response ListOperatorSigningKeys200JSONResponse) VisitListOperatorSigningKeysResponse(ctx *fiber.Ctx) error { + ctx.Response().Header.Set("Content-Type", "application/json") + ctx.Status(200) + + return ctx.JSON(&response) +} + +type CreateOperatorSigningKeyRequestObject struct { + OperatorId OperatorId `json:"operatorId"` +} + +type CreateOperatorSigningKeyResponseObject interface { + VisitCreateOperatorSigningKeyResponse(ctx *fiber.Ctx) error +} + +type CreateOperatorSigningKey201JSONResponse KeyPair + +func (response CreateOperatorSigningKey201JSONResponse) VisitCreateOperatorSigningKeyResponse(ctx *fiber.Ctx) error { + ctx.Response().Header.Set("Content-Type", "application/json") + ctx.Status(201) + + return ctx.JSON(&response) +} + type ListSystemsRequestObject struct { } @@ -887,23 +1246,23 @@ func (response GetTeam200JSONResponse) VisitGetTeamResponse(ctx *fiber.Ctx) erro return ctx.JSON(&response) } -type ListAccountsRequestObject struct { +type ListTeamAccountsRequestObject struct { TeamId TeamId `json:"teamId"` - Params ListAccountsParams + Params ListTeamAccountsParams } -type ListAccountsResponseObject interface { - VisitListAccountsResponse(ctx *fiber.Ctx) error +type ListTeamAccountsResponseObject interface { + VisitListTeamAccountsResponse(ctx *fiber.Ctx) error } -type ListAccounts200JSONResponse struct { +type ListTeamAccounts200JSONResponse struct { Limit *float32 `json:"limit,omitempty"` Offset *float32 `json:"offset,omitempty"` Results *[]Account `json:"results,omitempty"` Total *float32 `json:"total,omitempty"` } -func (response ListAccounts200JSONResponse) VisitListAccountsResponse(ctx *fiber.Ctx) error { +func (response ListTeamAccounts200JSONResponse) VisitListTeamAccountsResponse(ctx *fiber.Ctx) error { ctx.Response().Header.Set("Content-Type", "application/json") ctx.Status(200) @@ -1116,6 +1475,27 @@ type StrictServerInterface interface { // Creates a new operator // (POST /operators) CreateOperator(ctx context.Context, request CreateOperatorRequestObject) (CreateOperatorResponseObject, error) + // Deletes an operator by ID + // (DELETE /operators/{operatorId}) + DeleteOperator(ctx context.Context, request DeleteOperatorRequestObject) (DeleteOperatorResponseObject, error) + // Gets an operator by ID + // (GET /operators/{operatorId}) + GetOperator(ctx context.Context, request GetOperatorRequestObject) (GetOperatorResponseObject, error) + // Updates an operator by ID + // (PUT /operators/{operatorId}) + UpdateOperator(ctx context.Context, request UpdateOperatorRequestObject) (UpdateOperatorResponseObject, error) + // List all accounts for an operator + // (GET /operators/{operatorId}/accounts) + ListOperatorAccounts(ctx context.Context, request ListOperatorAccountsRequestObject) (ListOperatorAccountsResponseObject, error) + // Creates a new account + // (POST /operators/{operatorId}/accounts) + CreateOperatorAccount(ctx context.Context, request CreateOperatorAccountRequestObject) (CreateOperatorAccountResponseObject, error) + // List all signing keys for an operator + // (GET /operators/{operatorId}/signing-keys) + ListOperatorSigningKeys(ctx context.Context, request ListOperatorSigningKeysRequestObject) (ListOperatorSigningKeysResponseObject, error) + // Creates a new signing key + // (POST /operators/{operatorId}/signing-keys) + CreateOperatorSigningKey(ctx context.Context, request CreateOperatorSigningKeyRequestObject) (CreateOperatorSigningKeyResponseObject, error) // List all managed systems. // (GET /systems) ListSystems(ctx context.Context, request ListSystemsRequestObject) (ListSystemsResponseObject, error) @@ -1139,7 +1519,7 @@ type StrictServerInterface interface { GetTeam(ctx context.Context, request GetTeamRequestObject) (GetTeamResponseObject, error) // List all accounts for a team // (GET /teams/{teamId}/accounts) - ListAccounts(ctx context.Context, request ListAccountsRequestObject) (ListAccountsResponseObject, error) + ListTeamAccounts(ctx context.Context, request ListTeamAccountsRequestObject) (ListTeamAccountsResponseObject, error) // Gets an account by ID // (GET /teams/{teamId}/accounts/{accountId}) GetAccount(ctx context.Context, request GetAccountRequestObject) (GetAccountResponseObject, error) @@ -1243,6 +1623,209 @@ func (sh *strictHandler) CreateOperator(ctx *fiber.Ctx) error { return nil } +// DeleteOperator operation middleware +func (sh *strictHandler) DeleteOperator(ctx *fiber.Ctx, operatorId OperatorId) error { + var request DeleteOperatorRequestObject + + request.OperatorId = operatorId + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.DeleteOperator(ctx.UserContext(), request.(DeleteOperatorRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "DeleteOperator") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.(DeleteOperatorResponseObject); ok { + if err := validResponse.VisitDeleteOperatorResponse(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil +} + +// GetOperator operation middleware +func (sh *strictHandler) GetOperator(ctx *fiber.Ctx, operatorId OperatorId) error { + var request GetOperatorRequestObject + + request.OperatorId = operatorId + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.GetOperator(ctx.UserContext(), request.(GetOperatorRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "GetOperator") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.(GetOperatorResponseObject); ok { + if err := validResponse.VisitGetOperatorResponse(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil +} + +// UpdateOperator operation middleware +func (sh *strictHandler) UpdateOperator(ctx *fiber.Ctx, operatorId OperatorId) error { + var request UpdateOperatorRequestObject + + request.OperatorId = operatorId + + var body UpdateOperatorJSONRequestBody + if err := ctx.BodyParser(&body); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + request.Body = &body + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.UpdateOperator(ctx.UserContext(), request.(UpdateOperatorRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "UpdateOperator") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.(UpdateOperatorResponseObject); ok { + if err := validResponse.VisitUpdateOperatorResponse(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil +} + +// ListOperatorAccounts operation middleware +func (sh *strictHandler) ListOperatorAccounts(ctx *fiber.Ctx, operatorId OperatorId, params ListOperatorAccountsParams) error { + var request ListOperatorAccountsRequestObject + + request.OperatorId = operatorId + request.Params = params + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.ListOperatorAccounts(ctx.UserContext(), request.(ListOperatorAccountsRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "ListOperatorAccounts") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.(ListOperatorAccountsResponseObject); ok { + if err := validResponse.VisitListOperatorAccountsResponse(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil +} + +// CreateOperatorAccount operation middleware +func (sh *strictHandler) CreateOperatorAccount(ctx *fiber.Ctx, operatorId OperatorId) error { + var request CreateOperatorAccountRequestObject + + request.OperatorId = operatorId + + var body CreateOperatorAccountJSONRequestBody + if err := ctx.BodyParser(&body); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + request.Body = &body + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.CreateOperatorAccount(ctx.UserContext(), request.(CreateOperatorAccountRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CreateOperatorAccount") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.(CreateOperatorAccountResponseObject); ok { + if err := validResponse.VisitCreateOperatorAccountResponse(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil +} + +// ListOperatorSigningKeys operation middleware +func (sh *strictHandler) ListOperatorSigningKeys(ctx *fiber.Ctx, operatorId OperatorId, params ListOperatorSigningKeysParams) error { + var request ListOperatorSigningKeysRequestObject + + request.OperatorId = operatorId + request.Params = params + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.ListOperatorSigningKeys(ctx.UserContext(), request.(ListOperatorSigningKeysRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "ListOperatorSigningKeys") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.(ListOperatorSigningKeysResponseObject); ok { + if err := validResponse.VisitListOperatorSigningKeysResponse(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil +} + +// CreateOperatorSigningKey operation middleware +func (sh *strictHandler) CreateOperatorSigningKey(ctx *fiber.Ctx, operatorId OperatorId) error { + var request CreateOperatorSigningKeyRequestObject + + request.OperatorId = operatorId + + handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { + return sh.ssi.CreateOperatorSigningKey(ctx.UserContext(), request.(CreateOperatorSigningKeyRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CreateOperatorSigningKey") + } + + response, err := handler(ctx, request) + + if err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } else if validResponse, ok := response.(CreateOperatorSigningKeyResponseObject); ok { + if err := validResponse.VisitCreateOperatorSigningKeyResponse(ctx); err != nil { + return fiber.NewError(fiber.StatusBadRequest, err.Error()) + } + } else if response != nil { + return fmt.Errorf("unexpected response type: %T", response) + } + return nil +} + // ListSystems operation middleware func (sh *strictHandler) ListSystems(ctx *fiber.Ctx) error { var request ListSystemsRequestObject @@ -1444,26 +2027,26 @@ func (sh *strictHandler) GetTeam(ctx *fiber.Ctx, teamId TeamId) error { return nil } -// ListAccounts operation middleware -func (sh *strictHandler) ListAccounts(ctx *fiber.Ctx, teamId TeamId, params ListAccountsParams) error { - var request ListAccountsRequestObject +// ListTeamAccounts operation middleware +func (sh *strictHandler) ListTeamAccounts(ctx *fiber.Ctx, teamId TeamId, params ListTeamAccountsParams) error { + var request ListTeamAccountsRequestObject request.TeamId = teamId request.Params = params handler := func(ctx *fiber.Ctx, request interface{}) (interface{}, error) { - return sh.ssi.ListAccounts(ctx.UserContext(), request.(ListAccountsRequestObject)) + return sh.ssi.ListTeamAccounts(ctx.UserContext(), request.(ListTeamAccountsRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "ListAccounts") + handler = middleware(handler, "ListTeamAccounts") } response, err := handler(ctx, request) if err != nil { return fiber.NewError(fiber.StatusBadRequest, err.Error()) - } else if validResponse, ok := response.(ListAccountsResponseObject); ok { - if err := validResponse.VisitListAccountsResponse(ctx); err != nil { + } else if validResponse, ok := response.(ListTeamAccountsResponseObject); ok { + if err := validResponse.VisitListTeamAccountsResponse(ctx); err != nil { return fiber.NewError(fiber.StatusBadRequest, err.Error()) } } else if response != nil {