From 53a35f909b75e0ce81564a95bfb1d54b91f19a8e Mon Sep 17 00:00:00 2001 From: Murad Biashimov Date: Fri, 17 May 2024 12:30:57 +0200 Subject: [PATCH] feat: add new endpoints --- client.go | 1 + client_generated.go | 8 + config.yaml | 206 ++++++++++-------- generator/main.go | 71 ++++-- handler/accountteam/accountteam.go | 25 +++ handler/applicationuser/applicationuser.go | 185 ++++++++++++++++ handler/clickhouse/clickhouse.go | 39 ++++ handler/organization/organization.go | 77 +++++++ handler/projectbilling/projectbilling.go | 35 +++ handler/service/service.go | 3 +- .../serviceintegration/serviceintegration.go | 3 +- handler/thanos/thanos.go | 58 +++++ handler/user/user.go | 10 + version.go | 2 +- 14 files changed, 612 insertions(+), 111 deletions(-) create mode 100644 handler/applicationuser/applicationuser.go create mode 100644 handler/thanos/thanos.go diff --git a/client.go b/client.go index f1fffc6..b73e6b3 100644 --- a/client.go +++ b/client.go @@ -54,6 +54,7 @@ func NewClient(opts ...Option) (Client, error) { // Removes trailing / so it is easier later Host + URL d.Host = strings.TrimSuffix(d.Host, "/") + return newClient(d), nil } diff --git a/client_generated.go b/client_generated.go index d692b7f..7a3d7bc 100644 --- a/client_generated.go +++ b/client_generated.go @@ -9,6 +9,7 @@ import ( accountauthentication "github.com/aiven/go-client-codegen/handler/accountauthentication" accountteam "github.com/aiven/go-client-codegen/handler/accountteam" accountteammember "github.com/aiven/go-client-codegen/handler/accountteammember" + applicationuser "github.com/aiven/go-client-codegen/handler/applicationuser" billinggroup "github.com/aiven/go-client-codegen/handler/billinggroup" clickhouse "github.com/aiven/go-client-codegen/handler/clickhouse" cloud "github.com/aiven/go-client-codegen/handler/cloud" @@ -35,6 +36,7 @@ import ( serviceintegration "github.com/aiven/go-client-codegen/handler/serviceintegration" serviceuser "github.com/aiven/go-client-codegen/handler/serviceuser" staticip "github.com/aiven/go-client-codegen/handler/staticip" + thanos "github.com/aiven/go-client-codegen/handler/thanos" user "github.com/aiven/go-client-codegen/handler/user" usergroup "github.com/aiven/go-client-codegen/handler/usergroup" vpc "github.com/aiven/go-client-codegen/handler/vpc" @@ -50,6 +52,7 @@ func newClient(doer doer) Client { AccountHandler: account.NewHandler(doer), AccountTeamHandler: accountteam.NewHandler(doer), AccountTeamMemberHandler: accountteammember.NewHandler(doer), + ApplicationUserHandler: applicationuser.NewHandler(doer), BillingGroupHandler: billinggroup.NewHandler(doer), ClickHouseHandler: clickhouse.NewHandler(doer), CloudHandler: cloud.NewHandler(doer), @@ -76,6 +79,7 @@ func newClient(doer doer) Client { ServiceIntegrationHandler: serviceintegration.NewHandler(doer), ServiceUserHandler: serviceuser.NewHandler(doer), StaticIPHandler: staticip.NewHandler(doer), + ThanosHandler: thanos.NewHandler(doer), UserGroupHandler: usergroup.NewHandler(doer), UserHandler: user.NewHandler(doer), VpcHandler: vpc.NewHandler(doer), @@ -87,6 +91,7 @@ type client struct { accountauthentication.AccountAuthenticationHandler accountteam.AccountTeamHandler accountteammember.AccountTeamMemberHandler + applicationuser.ApplicationUserHandler billinggroup.BillingGroupHandler clickhouse.ClickHouseHandler cloud.CloudHandler @@ -113,6 +118,7 @@ type client struct { serviceintegration.ServiceIntegrationHandler serviceuser.ServiceUserHandler staticip.StaticIPHandler + thanos.ThanosHandler user.UserHandler usergroup.UserGroupHandler vpc.VpcHandler @@ -122,6 +128,7 @@ type Client interface { accountauthentication.Handler accountteam.Handler accountteammember.Handler + applicationuser.Handler billinggroup.Handler clickhouse.Handler cloud.Handler @@ -148,6 +155,7 @@ type Client interface { serviceintegration.Handler serviceuser.Handler staticip.Handler + thanos.Handler user.Handler usergroup.Handler vpc.Handler diff --git a/config.yaml b/config.yaml index 496055f..18836dc 100644 --- a/config.yaml +++ b/config.yaml @@ -1,22 +1,3 @@ -AccountTeam: - - AccountTeamDelete - - AccountTeamGet - - AccountTeamInvitesList - - AccountTeamList - - AccountTeamProjectAssociate - - AccountTeamProjectDisassociate - - AccountTeamUpdate -AccountTeamMember: - - AccountTeamMemberCancelInvite - - AccountTeamMemberVerifyInvite - - AccountTeamMembersInvite - - AccountTeamMembersList -AccountAuthentication: - - AccountAuthenticationMethodCreate - - AccountAuthenticationMethodDelete - - AccountAuthenticationMethodGet - - AccountAuthenticationMethodUpdate - - AccountAuthenticationMethodsList Account: - AccountAttachPaymentMethod - AccountBillingGroupList @@ -32,6 +13,34 @@ Account: - AccountUpdate - AccountUserProjectsList - AccountUsersSearch +AccountAuthentication: + - AccountAuthenticationMethodCreate + - AccountAuthenticationMethodDelete + - AccountAuthenticationMethodGet + - AccountAuthenticationMethodUpdate + - AccountAuthenticationMethodsList +AccountTeam: + - AccountTeamDelete + - AccountTeamGet + - AccountTeamInvitesList + - AccountTeamList + - AccountTeamProjectAssociate + - AccountTeamProjectDisassociate + - AccountTeamProjectList + - AccountTeamUpdate +AccountTeamMember: + - AccountTeamMemberCancelInvite + - AccountTeamMemberVerifyInvite + - AccountTeamMembersInvite + - AccountTeamMembersList +ApplicationUser: + - ApplicationUserAccessTokenCreate + - ApplicationUserAccessTokenDelete + - ApplicationUserAccessTokensList + - ApplicationUserCreate + - ApplicationUserDelete + - ApplicationUserGet + - ApplicationUsersList BillingGroup: - BillingGroupCreate - BillingGroupCreditsClaim @@ -39,6 +48,7 @@ BillingGroup: - BillingGroupDelete - BillingGroupEventList - BillingGroupGet + - BillingGroupInvoiceCsvGet - BillingGroupInvoiceDownload - BillingGroupInvoiceLinesList - BillingGroupInvoiceList @@ -50,6 +60,7 @@ BillingGroup: ClickHouse: - ServiceClickHouseDatabaseCreate - ServiceClickHouseDatabaseDelete + - ServiceClickHouseDatabaseList - ServiceClickHouseQueryStats - ServiceClickHouseTieredStorageSummary Cloud: @@ -61,6 +72,14 @@ Domain: - OrganizationDomainVerify - OrganizationDomainsList - OrganizationDomainsRemove +Flink: + - ServiceFlinkOverview +FlinkApplication: + - ServiceFlinkCreateApplication + - ServiceFlinkDeleteApplication + - ServiceFlinkGetApplication + - ServiceFlinkListApplications + - ServiceFlinkUpdateApplication FlinkApplicationDeployment: - ServiceFlinkCancelApplicationDeployment - ServiceFlinkCreateApplicationDeployment @@ -68,12 +87,6 @@ FlinkApplicationDeployment: - ServiceFlinkGetApplicationDeployment - ServiceFlinkListApplicationDeployments - ServiceFlinkStopApplicationDeployment -FlinkApplication: - - ServiceFlinkCreateApplication - - ServiceFlinkDeleteApplication - - ServiceFlinkGetApplication - - ServiceFlinkListApplications - - ServiceFlinkUpdateApplication FlinkApplicationVersion: - ServiceFlinkCreateApplicationVersion - ServiceFlinkDeleteApplicationVersion @@ -82,16 +95,6 @@ FlinkApplicationVersion: FlinkJob: - ServiceFlinkJobDetails - ServiceFlinkJobsList -Flink: - - ServiceFlinkOverview -UserGroup: - - UserGroupCreate - - UserGroupDelete - - UserGroupGet - - UserGroupMemberList - - UserGroupMembersUpdate - - UserGroupUpdate - - UserGroupsList Kafka: - ServiceKafkaAclAdd - ServiceKafkaAclDelete @@ -115,14 +118,12 @@ KafkaConnect: - ServiceKafkaConnectRestartConnector - ServiceKafkaConnectRestartConnectorTask - ServiceKafkaConnectResumeConnector -KafkaTopic: - - ServiceKafkaTopicCreate - - ServiceKafkaTopicDelete - - ServiceKafkaTopicGet - - ServiceKafkaTopicList - - ServiceKafkaTopicMessageList - - ServiceKafkaTopicMessageProduce - - ServiceKafkaTopicUpdate +KafkaMirrorMaker: + - ServiceKafkaMirrorMakerCreateReplicationFlow + - ServiceKafkaMirrorMakerDeleteReplicationFlow + - ServiceKafkaMirrorMakerGetReplicationFlow + - ServiceKafkaMirrorMakerGetReplicationFlows + - ServiceKafkaMirrorMakerPatchReplicationFlow KafkaSchemaRegistry: - ServiceSchemaRegistryAclAdd - ServiceSchemaRegistryAclDelete @@ -139,12 +140,14 @@ KafkaSchemaRegistry: - ServiceSchemaRegistrySubjectVersionPost - ServiceSchemaRegistrySubjectVersionsGet - ServiceSchemaRegistrySubjects -KafkaMirrorMaker: - - ServiceKafkaMirrorMakerCreateReplicationFlow - - ServiceKafkaMirrorMakerDeleteReplicationFlow - - ServiceKafkaMirrorMakerGetReplicationFlow - - ServiceKafkaMirrorMakerGetReplicationFlows - - ServiceKafkaMirrorMakerPatchReplicationFlow +KafkaTopic: + - ServiceKafkaTopicCreate + - ServiceKafkaTopicDelete + - ServiceKafkaTopicGet + - ServiceKafkaTopicList + - ServiceKafkaTopicMessageList + - ServiceKafkaTopicMessageProduce + - ServiceKafkaTopicUpdate MySQL: - MySQLServiceQueryStatistics OpenSearch: @@ -157,6 +160,9 @@ OpenSearch: - ServiceOpenSearchSecurityReset - ServiceOpenSearchSecuritySet Organization: + - OrganizationAuthDomainLink + - OrganizationAuthDomainList + - OrganizationAuthDomainUnlink - OrganizationAuthenticationConfigGet - OrganizationAuthenticationConfigUpdate - OrganizationGet @@ -164,13 +170,41 @@ Organization: - OrganizationUpdate - UserOrganizationCreate - UserOrganizationsList +OrganizationUser: + - OrganizationUserAuthenticationMethodsList + - OrganizationUserDelete + - OrganizationUserGet + - OrganizationUserInvitationAccept + - OrganizationUserInvitationDelete + - OrganizationUserInvitationsList + - OrganizationUserInvite + - OrganizationUserList + - OrganizationUserPasswordReset + - OrganizationUserRevokeToken + - OrganizationUserSet + - OrganizationUserTokensList + - OrganizationUserUpdate PostgreSQL: - PGServiceAvailableExtensions - PGServiceQueryStatistics + - PgAvailableExtensions - ServicePGBouncerCreate - ServicePGBouncerDelete - ServicePGBouncerUpdate - - PgAvailableExtensions +Privatelink: + - PublicPrivatelinkAvailabilityList + - ServicePrivatelinkAWSConnectionList + - ServicePrivatelinkAWSCreate + - ServicePrivatelinkAWSDelete + - ServicePrivatelinkAWSGet + - ServicePrivatelinkAWSUpdate + - ServicePrivatelinkAzureConnectionApproval + - ServicePrivatelinkAzureConnectionList + - ServicePrivatelinkAzureConnectionUpdate + - ServicePrivatelinkAzureCreate + - ServicePrivatelinkAzureDelete + - ServicePrivatelinkAzureGet + - ServicePrivatelinkAzureUpdate Project: - ListProjectVpcPeeringConnectionTypes - ProjectAlertsList @@ -193,17 +227,8 @@ Project: - ProjectUserList - ProjectUserRemove - ProjectUserUpdate -Vpc: - - VpcCreate - - VpcDelete - - VpcGet - - VpcList - - VpcPeeringConnectionCreate - - VpcPeeringConnectionDelete - - VpcPeeringConnectionUpdate - - VpcPeeringConnectionWithRegionDelete - - VpcPeeringConnectionWithResourceGroupDelete ProjectBilling: + - InvoiceGet - ProjectCreditsClaim - ProjectCreditsList - ProjectInvoiceGet @@ -240,26 +265,6 @@ Service: - ServiceTaskGet - ServiceUpdate - ServiceUpdate -Privatelink: - - PublicPrivatelinkAvailabilityList - - ServicePrivatelinkAWSConnectionList - - ServicePrivatelinkAWSCreate - - ServicePrivatelinkAWSDelete - - ServicePrivatelinkAWSGet - - ServicePrivatelinkAWSUpdate - - ServicePrivatelinkAzureConnectionApproval - - ServicePrivatelinkAzureConnectionList - - ServicePrivatelinkAzureConnectionUpdate - - ServicePrivatelinkAzureCreate - - ServicePrivatelinkAzureDelete - - ServicePrivatelinkAzureGet - - ServicePrivatelinkAzureUpdate -ServiceUser: - - ServiceUserCreate - - ServiceUserCredentialsModify - - ServiceUserCredentialsReset - - ServiceUserDelete - - ServiceUserGet ServiceIntegration: - ServiceIntegrationCreate - ServiceIntegrationDelete @@ -273,6 +278,12 @@ ServiceIntegration: - ServiceIntegrationList - ServiceIntegrationTypes - ServiceIntegrationUpdate +ServiceUser: + - ServiceUserCreate + - ServiceUserCredentialsModify + - ServiceUserCredentialsReset + - ServiceUserDelete + - ServiceUserGet StaticIP: - ProjectStaticIPAssociate - ProjectStaticIPAvailabilityList @@ -281,20 +292,8 @@ StaticIP: - PublicStaticIPAvailabilityList - StaticIPCreate - StaticIPList -OrganizationUser: - - OrganizationUserAuthenticationMethodsList - - OrganizationUserDelete - - OrganizationUserGet - - OrganizationUserInvitationAccept - - OrganizationUserInvitationDelete - - OrganizationUserInvitationsList - - OrganizationUserInvite - - OrganizationUserList - - OrganizationUserPasswordReset - - OrganizationUserRevokeToken - - OrganizationUserSet - - OrganizationUserTokensList - - OrganizationUserUpdate +Thanos: + - ServiceThanosStorageSummary User: - AccessTokenCreate - AccessTokenList @@ -305,6 +304,7 @@ User: - OrganizationMemberGroupsList - TwoFactorAuthConfigure - TwoFactorAuthConfigureOTP + - UserAccountDelete - UserAccountInvitesAccept - UserAccountInvitesList - UserAuth @@ -322,3 +322,21 @@ User: - UserVerifyEmail - ValidateCreditCode - ValidateReferralCode +UserGroup: + - UserGroupCreate + - UserGroupDelete + - UserGroupGet + - UserGroupMemberList + - UserGroupMembersUpdate + - UserGroupUpdate + - UserGroupsList +Vpc: + - VpcCreate + - VpcDelete + - VpcGet + - VpcList + - VpcPeeringConnectionCreate + - VpcPeeringConnectionDelete + - VpcPeeringConnectionUpdate + - VpcPeeringConnectionWithRegionDelete + - VpcPeeringConnectionWithResourceGroupDelete diff --git a/generator/main.go b/generator/main.go index 4354ef5..cadc8e7 100644 --- a/generator/main.go +++ b/generator/main.go @@ -4,18 +4,22 @@ package main import ( + "bytes" "encoding/json" "fmt" - "log" "os" "path/filepath" "regexp" "sort" "strings" + "time" "github.com/dave/jennifer/jen" "github.com/iancoleman/strcase" "github.com/kelseyhightower/envconfig" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + "golang.org/x/exp/slices" "gopkg.in/yaml.v3" ) @@ -25,7 +29,7 @@ const ( defaultAPIVersion = "v1" ) -type config struct { +type envConfig struct { Module string `envconfig:"MODULE" default:"github.com/aiven/go-client-codegen"` Package string `envconfig:"PACKAGE" default:"aiven"` HandlerDir string `envconfig:"HANDLER_DIR" default:"handler"` @@ -40,29 +44,24 @@ var ( ) func main() { + log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: time.RFC3339}) + err := exec() if err != nil { - log.Fatal(err) + log.Err(err) } } // nolint:funlen,gocognit,gocyclo // It's a generator, it's supposed to be long, and we won't expand it. func exec() error { - cfg := new(config) + cfg := new(envConfig) err := envconfig.Process(configPrefix, cfg) if err != nil { return err } - configBytes, err := os.ReadFile(cfg.ConfigFile) - if err != nil { - return err - } - - config := make(map[string][]string) - - err = yaml.Unmarshal(configBytes, &config) + config, err := readConfig(cfg.ConfigFile) if err != nil { return err } @@ -81,7 +80,8 @@ func exec() error { pkgs := make(map[string][]*Path) - for path, v := range doc.Paths { + for path := range doc.Paths { + v := doc.Paths[path] for meth, p := range v { if p.Deprecated { continue @@ -108,7 +108,7 @@ func exec() error { } if pkg == "" { - log.Printf("%q id not found in config. Skipping", p.ID) + log.Error().Msgf("%q id not found in config!", p.ID) continue } @@ -481,3 +481,46 @@ func toSingle(src string) string { return strings.TrimSuffix(src, "s") } + +const ( + yamlTabSize = 2 + writeMode = os.FileMode(0644) +) + +// readConfig reads and formats the config +func readConfig(path string) (map[string][]string, error) { + filePath := filepath.Clean(path) + + b, err := os.ReadFile(filePath) + if err != nil { + return nil, err + } + + c := make(map[string][]string) + + err = yaml.Unmarshal(b, &c) + if err != nil { + return nil, err + } + + // Updates the config + for _, v := range c { + slices.Sort(v) + } + + var buffer bytes.Buffer + encoder := yaml.NewEncoder(&buffer) + encoder.SetIndent(yamlTabSize) + + err = encoder.Encode(&c) + if err != nil { + return nil, err + } + + err = os.WriteFile(filePath, buffer.Bytes(), writeMode) + if err != nil { + return nil, err + } + + return c, nil +} diff --git a/handler/accountteam/accountteam.go b/handler/accountteam/accountteam.go index d2134e0..b3d9c96 100644 --- a/handler/accountteam/accountteam.go +++ b/handler/accountteam/accountteam.go @@ -40,6 +40,11 @@ type Handler interface { // https://api.aiven.io/doc/#tag/Account/operation/AccountTeamProjectDisassociate AccountTeamProjectDisassociate(ctx context.Context, accountId string, teamId string, project string) error + // AccountTeamProjectList list projects associated to a team + // GET /v1/account/{account_id}/team/{team_id}/projects + // https://api.aiven.io/doc/#tag/Account/operation/AccountTeamProjectList + AccountTeamProjectList(ctx context.Context, accountId string, teamId string) ([]ProjectOut, error) + // AccountTeamUpdate update team details // PUT /v1/account/{account_id}/team/{team_id} // https://api.aiven.io/doc/#tag/Account/operation/AccountTeamUpdate @@ -112,6 +117,19 @@ func (h *AccountTeamHandler) AccountTeamProjectDisassociate(ctx context.Context, _, err := h.doer.Do(ctx, "AccountTeamProjectDisassociate", "DELETE", path, nil) return err } +func (h *AccountTeamHandler) AccountTeamProjectList(ctx context.Context, accountId string, teamId string) ([]ProjectOut, error) { + path := fmt.Sprintf("/v1/account/%s/team/%s/projects", accountId, teamId) + b, err := h.doer.Do(ctx, "AccountTeamProjectList", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(accountTeamProjectListOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out.Projects, nil +} func (h *AccountTeamHandler) AccountTeamUpdate(ctx context.Context, accountId string, teamId string, in *AccountTeamUpdateIn) (*AccountTeamUpdateOut, error) { path := fmt.Sprintf("/v1/account/%s/team/%s", accountId, teamId) b, err := h.doer.Do(ctx, "AccountTeamUpdate", "PUT", path, in) @@ -155,6 +173,10 @@ type AccountTeamUpdateOut struct { TeamName string `json:"team_name"` UpdateTime *time.Time `json:"update_time,omitempty"` } +type ProjectOut struct { + ProjectName string `json:"project_name"` + TeamType TeamType `json:"team_type"` +} type TeamOut struct { AccountId string `json:"account_id,omitempty"` CreateTime *time.Time `json:"create_time,omitempty"` @@ -184,6 +206,9 @@ type accountTeamInvitesListOut struct { type accountTeamListOut struct { Teams []TeamOut `json:"teams"` } +type accountTeamProjectListOut struct { + Projects []ProjectOut `json:"projects"` +} type accountTeamUpdateOut struct { Team AccountTeamUpdateOut `json:"team"` } diff --git a/handler/applicationuser/applicationuser.go b/handler/applicationuser/applicationuser.go new file mode 100644 index 0000000..39a8a1c --- /dev/null +++ b/handler/applicationuser/applicationuser.go @@ -0,0 +1,185 @@ +// Code generated by Aiven. DO NOT EDIT. + +package applicationuser + +import ( + "context" + "encoding/json" + "fmt" + "time" +) + +type Handler interface { + // ApplicationUserAccessTokenCreate create an application token + // POST /v1/organization/{organization_id}/application-users/{user_id}/access-tokens + // https://api.aiven.io/doc/#tag/Application_Users/operation/ApplicationUserAccessTokenCreate + ApplicationUserAccessTokenCreate(ctx context.Context, organizationId string, userId string, in *ApplicationUserAccessTokenCreateIn) (*ApplicationUserAccessTokenCreateOut, error) + + // ApplicationUserAccessTokenDelete delete an application token + // DELETE /v1/organization/{organization_id}/application-users/{user_id}/access-tokens/{token_prefix} + // https://api.aiven.io/doc/#tag/Application_Users/operation/ApplicationUserAccessTokenDelete + ApplicationUserAccessTokenDelete(ctx context.Context, organizationId string, userId string, tokenPrefix string) error + + // ApplicationUserAccessTokensList list application tokens + // GET /v1/organization/{organization_id}/application-users/{user_id}/access-tokens + // https://api.aiven.io/doc/#tag/Application_Users/operation/ApplicationUserAccessTokensList + ApplicationUserAccessTokensList(ctx context.Context, organizationId string, userId string) ([]TokenOut, error) + + // ApplicationUserCreate create an application user + // POST /v1/organization/{organization_id}/application-users + // https://api.aiven.io/doc/#tag/Application_Users/operation/ApplicationUserCreate + ApplicationUserCreate(ctx context.Context, organizationId string, in *ApplicationUserCreateIn) (*ApplicationUserCreateOut, error) + + // ApplicationUserDelete delete an application user + // DELETE /v1/organization/{organization_id}/application-users/{user_id} + // https://api.aiven.io/doc/#tag/Application_Users/operation/ApplicationUserDelete + ApplicationUserDelete(ctx context.Context, organizationId string, userId string) error + + // ApplicationUserGet get an application user + // GET /v1/organization/{organization_id}/application-users/{user_id} + // https://api.aiven.io/doc/#tag/Application_Users/operation/ApplicationUserGet + ApplicationUserGet(ctx context.Context, organizationId string, userId string) (*ApplicationUserGetOut, error) + + // ApplicationUsersList list application users + // GET /v1/organization/{organization_id}/application-users + // https://api.aiven.io/doc/#tag/Application_Users/operation/ApplicationUsersList + ApplicationUsersList(ctx context.Context, organizationId string) ([]ApplicationUserOut, error) +} + +func NewHandler(doer doer) ApplicationUserHandler { + return ApplicationUserHandler{doer} +} + +type doer interface { + Do(ctx context.Context, operationID, method, path string, v any) ([]byte, error) +} + +type ApplicationUserHandler struct { + doer doer +} + +func (h *ApplicationUserHandler) ApplicationUserAccessTokenCreate(ctx context.Context, organizationId string, userId string, in *ApplicationUserAccessTokenCreateIn) (*ApplicationUserAccessTokenCreateOut, error) { + path := fmt.Sprintf("/v1/organization/%s/application-users/%s/access-tokens", organizationId, userId) + b, err := h.doer.Do(ctx, "ApplicationUserAccessTokenCreate", "POST", path, in) + if err != nil { + return nil, err + } + out := new(ApplicationUserAccessTokenCreateOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *ApplicationUserHandler) ApplicationUserAccessTokenDelete(ctx context.Context, organizationId string, userId string, tokenPrefix string) error { + path := fmt.Sprintf("/v1/organization/%s/application-users/%s/access-tokens/%s", organizationId, userId, tokenPrefix) + _, err := h.doer.Do(ctx, "ApplicationUserAccessTokenDelete", "DELETE", path, nil) + return err +} +func (h *ApplicationUserHandler) ApplicationUserAccessTokensList(ctx context.Context, organizationId string, userId string) ([]TokenOut, error) { + path := fmt.Sprintf("/v1/organization/%s/application-users/%s/access-tokens", organizationId, userId) + b, err := h.doer.Do(ctx, "ApplicationUserAccessTokensList", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(applicationUserAccessTokensListOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out.Tokens, nil +} +func (h *ApplicationUserHandler) ApplicationUserCreate(ctx context.Context, organizationId string, in *ApplicationUserCreateIn) (*ApplicationUserCreateOut, error) { + path := fmt.Sprintf("/v1/organization/%s/application-users", organizationId) + b, err := h.doer.Do(ctx, "ApplicationUserCreate", "POST", path, in) + if err != nil { + return nil, err + } + out := new(ApplicationUserCreateOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *ApplicationUserHandler) ApplicationUserDelete(ctx context.Context, organizationId string, userId string) error { + path := fmt.Sprintf("/v1/organization/%s/application-users/%s", organizationId, userId) + _, err := h.doer.Do(ctx, "ApplicationUserDelete", "DELETE", path, nil) + return err +} +func (h *ApplicationUserHandler) ApplicationUserGet(ctx context.Context, organizationId string, userId string) (*ApplicationUserGetOut, error) { + path := fmt.Sprintf("/v1/organization/%s/application-users/%s", organizationId, userId) + b, err := h.doer.Do(ctx, "ApplicationUserGet", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(ApplicationUserGetOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *ApplicationUserHandler) ApplicationUsersList(ctx context.Context, organizationId string) ([]ApplicationUserOut, error) { + path := fmt.Sprintf("/v1/organization/%s/application-users", organizationId) + b, err := h.doer.Do(ctx, "ApplicationUsersList", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(applicationUsersListOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out.ApplicationUsers, nil +} + +type ApplicationUserAccessTokenCreateIn struct { + Description string `json:"description"` + ExtendWhenUsed *bool `json:"extend_when_used,omitempty"` + MaxAgeSeconds *int `json:"max_age_seconds,omitempty"` + Scopes *[]string `json:"scopes,omitempty"` +} +type ApplicationUserAccessTokenCreateOut struct { + FullToken string `json:"full_token"` + TokenPrefix string `json:"token_prefix"` +} +type ApplicationUserCreateIn struct { + Name string `json:"name"` +} +type ApplicationUserCreateOut struct { + Name string `json:"name"` + UserEmail string `json:"user_email"` + UserId string `json:"user_id"` +} +type ApplicationUserGetOut struct { + Name string `json:"name"` + UserEmail string `json:"user_email"` + UserId string `json:"user_id"` +} +type ApplicationUserOut struct { + Name string `json:"name"` + UserEmail string `json:"user_email"` + UserId string `json:"user_id"` +} +type TokenOut struct { + CreateTime time.Time `json:"create_time"` + CreatedManually bool `json:"created_manually"` + CurrentlyActive bool `json:"currently_active"` + Description string `json:"description,omitempty"` + ExpiryTime *time.Time `json:"expiry_time,omitempty"` + ExtendWhenUsed *bool `json:"extend_when_used,omitempty"` + LastIp string `json:"last_ip,omitempty"` + LastUsedTime *time.Time `json:"last_used_time,omitempty"` + LastUserAgent string `json:"last_user_agent,omitempty"` + LastUserAgentHumanReadable string `json:"last_user_agent_human_readable,omitempty"` + MaxAgeSeconds *int `json:"max_age_seconds,omitempty"` + Scopes []string `json:"scopes,omitempty"` + TokenPrefix string `json:"token_prefix"` +} +type applicationUserAccessTokensListOut struct { + Tokens []TokenOut `json:"tokens"` +} +type applicationUsersListOut struct { + ApplicationUsers []ApplicationUserOut `json:"application_users"` +} diff --git a/handler/clickhouse/clickhouse.go b/handler/clickhouse/clickhouse.go index 8398908..57c8859 100644 --- a/handler/clickhouse/clickhouse.go +++ b/handler/clickhouse/clickhouse.go @@ -19,6 +19,11 @@ type Handler interface { // https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseDatabaseDelete ServiceClickHouseDatabaseDelete(ctx context.Context, project string, serviceName string, database string) error + // ServiceClickHouseDatabaseList list all databases + // GET /v1/project/{project}/service/{service_name}/clickhouse/db + // https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseDatabaseList + ServiceClickHouseDatabaseList(ctx context.Context, project string, serviceName string) ([]DatabaseOut, error) + // ServiceClickHouseQueryStats return statistics on recent queries // GET /v1/project/{project}/service/{service_name}/clickhouse/query/stats // https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseQueryStats @@ -52,6 +57,19 @@ func (h *ClickHouseHandler) ServiceClickHouseDatabaseDelete(ctx context.Context, _, err := h.doer.Do(ctx, "ServiceClickHouseDatabaseDelete", "DELETE", path, nil) return err } +func (h *ClickHouseHandler) ServiceClickHouseDatabaseList(ctx context.Context, project string, serviceName string) ([]DatabaseOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/db", project, serviceName) + b, err := h.doer.Do(ctx, "ServiceClickHouseDatabaseList", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(serviceClickHouseDatabaseListOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out.Databases, nil +} func (h *ClickHouseHandler) ServiceClickHouseQueryStats(ctx context.Context, project string, serviceName string) ([]QueryOut, error) { path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/query/stats", project, serviceName) b, err := h.doer.Do(ctx, "ServiceClickHouseQueryStats", "GET", path, nil) @@ -79,6 +97,24 @@ func (h *ClickHouseHandler) ServiceClickHouseTieredStorageSummary(ctx context.Co return out, nil } +type DatabaseOut struct { + Engine string `json:"engine"` + Name string `json:"name"` + Required bool `json:"required"` + State DatabaseStateType `json:"state,omitempty"` +} +type DatabaseStateType string + +const ( + DatabaseStateTypeOk DatabaseStateType = "ok" + DatabaseStateTypePendingCreation DatabaseStateType = "pending_creation" + DatabaseStateTypePendingRemoval DatabaseStateType = "pending_removal" +) + +func DatabaseStateTypeChoices() []string { + return []string{"ok", "pending_creation", "pending_removal"} +} + type HourlyOut struct { EstimatedCost string `json:"estimated_cost,omitempty"` HourStart string `json:"hour_start"` @@ -109,6 +145,9 @@ type ServiceClickHouseTieredStorageSummaryOut struct { type StorageUsageHistoryOut struct { Hourly []HourlyOut `json:"hourly"` } +type serviceClickHouseDatabaseListOut struct { + Databases []DatabaseOut `json:"databases"` +} type serviceClickHouseQueryStatsOut struct { Queries []QueryOut `json:"queries"` } diff --git a/handler/organization/organization.go b/handler/organization/organization.go index 3eac44c..5560122 100644 --- a/handler/organization/organization.go +++ b/handler/organization/organization.go @@ -10,6 +10,21 @@ import ( ) type Handler interface { + // OrganizationAuthDomainLink link a domain to an organization's identity provider + // PUT /v1/organization/{organization_id}/authentication-methods/{authentication_method_id}/domains + // https://api.aiven.io/doc/#tag/Authentication_Methods/operation/OrganizationAuthDomainLink + OrganizationAuthDomainLink(ctx context.Context, organizationId string, authenticationMethodId string, in *OrganizationAuthDomainLinkIn) error + + // OrganizationAuthDomainList list domains linked to an organization's identity provider + // GET /v1/organization/{organization_id}/authentication-methods/{authentication_method_id}/domains + // https://api.aiven.io/doc/#tag/Authentication_Methods/operation/OrganizationAuthDomainList + OrganizationAuthDomainList(ctx context.Context, organizationId string, authenticationMethodId string) ([]DomainOut, error) + + // OrganizationAuthDomainUnlink unlink domain from authentication method + // DELETE /v1/organization/{organization_id}/authentication-methods/{authentication_method_id}/domains/{domain_id} + // https://api.aiven.io/doc/#tag/Authentication_Methods/operation/OrganizationAuthDomainUnlink + OrganizationAuthDomainUnlink(ctx context.Context, organizationId string, authenticationMethodId string, domainId string) error + // OrganizationAuthenticationConfigGet retrieve authentication configuration // GET /v1/organization/{organization_id}/config/authentication // https://api.aiven.io/doc/#tag/Organizations/operation/OrganizationAuthenticationConfigGet @@ -53,6 +68,29 @@ type OrganizationHandler struct { doer doer } +func (h *OrganizationHandler) OrganizationAuthDomainLink(ctx context.Context, organizationId string, authenticationMethodId string, in *OrganizationAuthDomainLinkIn) error { + path := fmt.Sprintf("/v1/organization/%s/authentication-methods/%s/domains", organizationId, authenticationMethodId) + _, err := h.doer.Do(ctx, "OrganizationAuthDomainLink", "PUT", path, in) + return err +} +func (h *OrganizationHandler) OrganizationAuthDomainList(ctx context.Context, organizationId string, authenticationMethodId string) ([]DomainOut, error) { + path := fmt.Sprintf("/v1/organization/%s/authentication-methods/%s/domains", organizationId, authenticationMethodId) + b, err := h.doer.Do(ctx, "OrganizationAuthDomainList", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(organizationAuthDomainListOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out.Domains, nil +} +func (h *OrganizationHandler) OrganizationAuthDomainUnlink(ctx context.Context, organizationId string, authenticationMethodId string, domainId string) error { + path := fmt.Sprintf("/v1/organization/%s/authentication-methods/%s/domains/%s", organizationId, authenticationMethodId, domainId) + _, err := h.doer.Do(ctx, "OrganizationAuthDomainUnlink", "DELETE", path, nil) + return err +} func (h *OrganizationHandler) OrganizationAuthenticationConfigGet(ctx context.Context, organizationId string) (*OrganizationAuthenticationConfigGetOut, error) { path := fmt.Sprintf("/v1/organization/%s/config/authentication", organizationId) b, err := h.doer.Do(ctx, "OrganizationAuthenticationConfigGet", "GET", path, nil) @@ -132,6 +170,31 @@ func (h *OrganizationHandler) UserOrganizationsList(ctx context.Context) ([]Orga return out.Organizations, nil } +type DomainOut struct { + ChallengeToken string `json:"challenge_token"` + CreateTime time.Time `json:"create_time"` + DomainId string `json:"domain_id"` + DomainName string `json:"domain_name"` + LinkedAuthenticationMethodIds []string `json:"linked_authentication_method_ids"` + OrganizationId string `json:"organization_id"` + State DomainStateType `json:"state"` + VerificationType VerificationType `json:"verification_type"` +} +type DomainStateType string + +const ( + DomainStateTypeDeleted DomainStateType = "deleted" + DomainStateTypeUnverified DomainStateType = "unverified" + DomainStateTypeVerified DomainStateType = "verified" +) + +func DomainStateTypeChoices() []string { + return []string{"deleted", "unverified", "verified"} +} + +type OrganizationAuthDomainLinkIn struct { + DomainId string `json:"domain_id"` +} type OrganizationAuthenticationConfigGetOut struct { OauthEnabled *bool `json:"oauth_enabled,omitempty"` PasswordAuthEnabled *bool `json:"password_auth_enabled,omitempty"` @@ -217,6 +280,20 @@ type UserOrganizationCreateOut struct { Tier TierType `json:"tier"` UpdateTime time.Time `json:"update_time"` } +type VerificationType string + +const ( + VerificationTypeDns VerificationType = "dns" + VerificationTypeHttp VerificationType = "http" +) + +func VerificationTypeChoices() []string { + return []string{"dns", "http"} +} + +type organizationAuthDomainListOut struct { + Domains []DomainOut `json:"domains"` +} type userOrganizationsListOut struct { Organizations []OrganizationOut `json:"organizations"` } diff --git a/handler/projectbilling/projectbilling.go b/handler/projectbilling/projectbilling.go index 412adeb..76f0118 100644 --- a/handler/projectbilling/projectbilling.go +++ b/handler/projectbilling/projectbilling.go @@ -10,6 +10,11 @@ import ( ) type Handler interface { + // InvoiceGet get a single invoice + // GET /v1/invoices/{invoice_number} + // https://api.aiven.io/doc/#tag/Billing/operation/InvoiceGet + InvoiceGet(ctx context.Context, invoiceNumber string) (*InvoiceGetOut, error) + // ProjectCreditsClaim claim a credit code // POST /v1/project/{project}/credits // https://api.aiven.io/doc/#tag/Project_Billing/operation/ProjectCreditsClaim @@ -38,6 +43,19 @@ type ProjectBillingHandler struct { doer doer } +func (h *ProjectBillingHandler) InvoiceGet(ctx context.Context, invoiceNumber string) (*InvoiceGetOut, error) { + path := fmt.Sprintf("/v1/invoices/%s", invoiceNumber) + b, err := h.doer.Do(ctx, "InvoiceGet", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(invoiceGetOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return &out.Invoice, nil +} func (h *ProjectBillingHandler) ProjectCreditsClaim(ctx context.Context, project string, in *ProjectCreditsClaimIn) (*ProjectCreditsClaimOut, error) { path := fmt.Sprintf("/v1/project/%s/credits", project) b, err := h.doer.Do(ctx, "ProjectCreditsClaim", "POST", path, in) @@ -140,6 +158,20 @@ func CurrencyTypeChoices() []string { return []string{"AUD", "CAD", "CHF", "DKK", "EUR", "GBP", "JPY", "NOK", "NZD", "SEK", "SGD", "USD"} } +type InvoiceGetOut struct { + BillingGroupId string `json:"billing_group_id"` + BillingGroupName string `json:"billing_group_name"` + BillingGroupState string `json:"billing_group_state"` + Currency string `json:"currency"` + DownloadCookie string `json:"download_cookie,omitempty"` + GeneratedAt time.Time `json:"generated_at"` + InvoiceNumber string `json:"invoice_number"` + PeriodBegin string `json:"period_begin"` + PeriodEnd string `json:"period_end"` + State string `json:"state"` + TotalIncVat string `json:"total_inc_vat"` + TotalVatZero string `json:"total_vat_zero"` +} type InvoiceOut struct { BillingGroupId string `json:"billing_group_id"` BillingGroupName string `json:"billing_group_name"` @@ -188,6 +220,9 @@ type ProjectCreditsClaimOut struct { Type CreditType `json:"type,omitempty"` Value string `json:"value,omitempty"` } +type invoiceGetOut struct { + Invoice InvoiceGetOut `json:"invoice"` +} type projectCreditsClaimOut struct { Credit ProjectCreditsClaimOut `json:"credit"` } diff --git a/handler/service/service.go b/handler/service/service.go index 162862b..22eed44 100644 --- a/handler/service/service.go +++ b/handler/service/service.go @@ -761,6 +761,7 @@ const ( IntegrationTypeRsyslog IntegrationType = "rsyslog" IntegrationTypeSchemaRegistryProxy IntegrationType = "schema_registry_proxy" IntegrationTypeStresstester IntegrationType = "stresstester" + IntegrationTypeThanosMigrate IntegrationType = "thanos_migrate" IntegrationTypeThanoscompactor IntegrationType = "thanoscompactor" IntegrationTypeThanosquery IntegrationType = "thanosquery" IntegrationTypeThanosstore IntegrationType = "thanosstore" @@ -769,7 +770,7 @@ const ( ) func IntegrationTypeChoices() []string { - return []string{"alertmanager", "autoscaler", "caching", "cassandra_cross_service_cluster", "clickhouse_credentials", "clickhouse_kafka", "clickhouse_postgresql", "dashboard", "datadog", "datasource", "external_aws_cloudwatch_logs", "external_aws_cloudwatch_metrics", "external_elasticsearch_logs", "external_google_cloud_logging", "external_opensearch_logs", "flink", "flink_external_bigquery", "flink_external_kafka", "flink_external_postgresql", "internal_connectivity", "jolokia", "kafka_connect", "kafka_connect_postgresql", "kafka_logs", "kafka_mirrormaker", "logs", "m3aggregator", "m3coordinator", "metrics", "opensearch_cross_cluster_replication", "opensearch_cross_cluster_search", "prometheus", "read_replica", "rsyslog", "schema_registry_proxy", "stresstester", "thanoscompactor", "thanosquery", "thanosstore", "vector", "vmalert"} + return []string{"alertmanager", "autoscaler", "caching", "cassandra_cross_service_cluster", "clickhouse_credentials", "clickhouse_kafka", "clickhouse_postgresql", "dashboard", "datadog", "datasource", "external_aws_cloudwatch_logs", "external_aws_cloudwatch_metrics", "external_elasticsearch_logs", "external_google_cloud_logging", "external_opensearch_logs", "flink", "flink_external_bigquery", "flink_external_kafka", "flink_external_postgresql", "internal_connectivity", "jolokia", "kafka_connect", "kafka_connect_postgresql", "kafka_logs", "kafka_mirrormaker", "logs", "m3aggregator", "m3coordinator", "metrics", "opensearch_cross_cluster_replication", "opensearch_cross_cluster_search", "prometheus", "read_replica", "rsyslog", "schema_registry_proxy", "stresstester", "thanos_migrate", "thanoscompactor", "thanosquery", "thanosstore", "vector", "vmalert"} } type KafkaAuthenticationMethodType string diff --git a/handler/serviceintegration/serviceintegration.go b/handler/serviceintegration/serviceintegration.go index 5d25f81..ce78adb 100644 --- a/handler/serviceintegration/serviceintegration.go +++ b/handler/serviceintegration/serviceintegration.go @@ -314,6 +314,7 @@ const ( IntegrationTypeRsyslog IntegrationType = "rsyslog" IntegrationTypeSchemaRegistryProxy IntegrationType = "schema_registry_proxy" IntegrationTypeStresstester IntegrationType = "stresstester" + IntegrationTypeThanosMigrate IntegrationType = "thanos_migrate" IntegrationTypeThanoscompactor IntegrationType = "thanoscompactor" IntegrationTypeThanosquery IntegrationType = "thanosquery" IntegrationTypeThanosstore IntegrationType = "thanosstore" @@ -322,7 +323,7 @@ const ( ) func IntegrationTypeChoices() []string { - return []string{"alertmanager", "autoscaler", "caching", "cassandra_cross_service_cluster", "clickhouse_credentials", "clickhouse_kafka", "clickhouse_postgresql", "dashboard", "datadog", "datasource", "external_aws_cloudwatch_logs", "external_aws_cloudwatch_metrics", "external_elasticsearch_logs", "external_google_cloud_logging", "external_opensearch_logs", "flink", "flink_external_bigquery", "flink_external_kafka", "flink_external_postgresql", "internal_connectivity", "jolokia", "kafka_connect", "kafka_connect_postgresql", "kafka_logs", "kafka_mirrormaker", "logs", "m3aggregator", "m3coordinator", "metrics", "opensearch_cross_cluster_replication", "opensearch_cross_cluster_search", "prometheus", "read_replica", "rsyslog", "schema_registry_proxy", "stresstester", "thanoscompactor", "thanosquery", "thanosstore", "vector", "vmalert"} + return []string{"alertmanager", "autoscaler", "caching", "cassandra_cross_service_cluster", "clickhouse_credentials", "clickhouse_kafka", "clickhouse_postgresql", "dashboard", "datadog", "datasource", "external_aws_cloudwatch_logs", "external_aws_cloudwatch_metrics", "external_elasticsearch_logs", "external_google_cloud_logging", "external_opensearch_logs", "flink", "flink_external_bigquery", "flink_external_kafka", "flink_external_postgresql", "internal_connectivity", "jolokia", "kafka_connect", "kafka_connect_postgresql", "kafka_logs", "kafka_mirrormaker", "logs", "m3aggregator", "m3coordinator", "metrics", "opensearch_cross_cluster_replication", "opensearch_cross_cluster_search", "prometheus", "read_replica", "rsyslog", "schema_registry_proxy", "stresstester", "thanos_migrate", "thanoscompactor", "thanosquery", "thanosstore", "vector", "vmalert"} } type IntegrationTypeOut struct { diff --git a/handler/thanos/thanos.go b/handler/thanos/thanos.go new file mode 100644 index 0000000..85220b9 --- /dev/null +++ b/handler/thanos/thanos.go @@ -0,0 +1,58 @@ +// Code generated by Aiven. DO NOT EDIT. + +package thanos + +import ( + "context" + "encoding/json" + "fmt" +) + +type Handler interface { + // ServiceThanosStorageSummary get Thanos object storage summary + // GET /v1/project/{project}/service/{service_name}/thanos/storage/summary + // https://api.aiven.io/doc/#tag/Service:_Thanos/operation/ServiceThanosStorageSummary + ServiceThanosStorageSummary(ctx context.Context, project string, serviceName string) (*ServiceThanosStorageSummaryOut, error) +} + +func NewHandler(doer doer) ThanosHandler { + return ThanosHandler{doer} +} + +type doer interface { + Do(ctx context.Context, operationID, method, path string, v any) ([]byte, error) +} + +type ThanosHandler struct { + doer doer +} + +func (h *ThanosHandler) ServiceThanosStorageSummary(ctx context.Context, project string, serviceName string) (*ServiceThanosStorageSummaryOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/thanos/storage/summary", project, serviceName) + b, err := h.doer.Do(ctx, "ServiceThanosStorageSummary", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceThanosStorageSummaryOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} + +type HourlyOut struct { + EstimatedCost string `json:"estimated_cost,omitempty"` + HourStart string `json:"hour_start"` + PeakStoredBytes int `json:"peak_stored_bytes"` +} +type ServiceThanosStorageSummaryOut struct { + CurrentCost string `json:"current_cost"` + ForecastedCost string `json:"forecasted_cost"` + ForecastedRate string `json:"forecasted_rate,omitempty"` + StorageUsageHistory StorageUsageHistoryOut `json:"storage_usage_history"` + TotalStorageUsage int `json:"total_storage_usage"` +} +type StorageUsageHistoryOut struct { + Hourly []HourlyOut `json:"hourly"` +} diff --git a/handler/user/user.go b/handler/user/user.go index 32515ee..8144310 100644 --- a/handler/user/user.go +++ b/handler/user/user.go @@ -55,6 +55,11 @@ type Handler interface { // https://api.aiven.io/doc/#tag/Users/operation/TwoFactorAuthConfigureOTP TwoFactorAuthConfigureOTP(ctx context.Context, in *TwoFactorAuthConfigureOtpIn) (*TwoFactorAuthConfigureOtpOut, error) + // UserAccountDelete delete user account + // DELETE /v1/user/{user_id} + // https://api.aiven.io/doc/#tag/Users/operation/UserAccountDelete + UserAccountDelete(ctx context.Context, userId string) error + // UserAccountInvitesAccept accept all invites for a single account // POST /v1/me/account/invites/accept // https://api.aiven.io/doc/#tag/Users/operation/UserAccountInvitesAccept @@ -257,6 +262,11 @@ func (h *UserHandler) TwoFactorAuthConfigureOTP(ctx context.Context, in *TwoFact } return out, nil } +func (h *UserHandler) UserAccountDelete(ctx context.Context, userId string) error { + path := fmt.Sprintf("/v1/user/%s", userId) + _, err := h.doer.Do(ctx, "UserAccountDelete", "DELETE", path, nil) + return err +} func (h *UserHandler) UserAccountInvitesAccept(ctx context.Context, in *UserAccountInvitesAcceptIn) ([]AccountInviteOut, error) { path := fmt.Sprintf("/v1/me/account/invites/accept") b, err := h.doer.Do(ctx, "UserAccountInvitesAccept", "POST", path, in) diff --git a/version.go b/version.go index 6d3ccf8..4f81e1b 100644 --- a/version.go +++ b/version.go @@ -2,5 +2,5 @@ package aiven // Version returns aiven-go-client version string func Version() string { - return "v0.5.0" + return "v0.5.0" }