diff --git a/generator/main.go b/generator/main.go index cadc8e7..2c5e5e0 100644 --- a/generator/main.go +++ b/generator/main.go @@ -282,7 +282,12 @@ func exec() error { continue } - urlParams = append(urlParams, jen.Id(strcase.ToLowerCamel(s.CamelName))) + v := jen.Id(strcase.ToLowerCamel(s.CamelName)) + if s.Type == SchemaTypeString { + v = jen.Id("url.PathEscape").Call(v) + } + + urlParams = append(urlParams, v) } outObj := jen.Id("_") diff --git a/handler/account/account.go b/handler/account/account.go index 01d5fb0..d31f256 100644 --- a/handler/account/account.go +++ b/handler/account/account.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -94,7 +95,7 @@ type AccountHandler struct { } func (h *AccountHandler) AccountAttachPaymentMethod(ctx context.Context, accountId string, in *AccountAttachPaymentMethodIn) (*AccountAttachPaymentMethodOut, error) { - path := fmt.Sprintf("/v1/account/%s/payment_methods", accountId) + path := fmt.Sprintf("/v1/account/%s/payment_methods", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountAttachPaymentMethod", "POST", path, in) if err != nil { return nil, err @@ -107,7 +108,7 @@ func (h *AccountHandler) AccountAttachPaymentMethod(ctx context.Context, account return &out.Card, nil } func (h *AccountHandler) AccountBillingGroupList(ctx context.Context, accountId string) ([]AccountBillingGroupOut, error) { - path := fmt.Sprintf("/v1/account/%s/billing-group", accountId) + path := fmt.Sprintf("/v1/account/%s/billing-group", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountBillingGroupList", "GET", path, nil) if err != nil { return nil, err @@ -133,12 +134,12 @@ func (h *AccountHandler) AccountCreate(ctx context.Context, in *AccountCreateIn) return &out.Account, nil } func (h *AccountHandler) AccountDelete(ctx context.Context, accountId string) error { - path := fmt.Sprintf("/v1/account/%s", accountId) + path := fmt.Sprintf("/v1/account/%s", url.PathEscape(accountId)) _, err := h.doer.Do(ctx, "AccountDelete", "DELETE", path, nil) return err } func (h *AccountHandler) AccountEventList(ctx context.Context, accountId string) ([]EventOut, error) { - path := fmt.Sprintf("/v1/account/%s/events", accountId) + path := fmt.Sprintf("/v1/account/%s/events", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountEventList", "GET", path, nil) if err != nil { return nil, err @@ -151,7 +152,7 @@ func (h *AccountHandler) AccountEventList(ctx context.Context, accountId string) return out.Events, nil } func (h *AccountHandler) AccountGet(ctx context.Context, accountId string) (*AccountGetOut, error) { - path := fmt.Sprintf("/v1/account/%s", accountId) + path := fmt.Sprintf("/v1/account/%s", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountGet", "GET", path, nil) if err != nil { return nil, err @@ -177,7 +178,7 @@ func (h *AccountHandler) AccountList(ctx context.Context) ([]AccountOut, error) return out.Accounts, nil } func (h *AccountHandler) AccountMove(ctx context.Context, accountId string, in *AccountMoveIn) (*AccountMoveOut, error) { - path := fmt.Sprintf("/v1/account/%s/parent_account", accountId) + path := fmt.Sprintf("/v1/account/%s/parent_account", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountMove", "PUT", path, in) if err != nil { return nil, err @@ -190,12 +191,12 @@ func (h *AccountHandler) AccountMove(ctx context.Context, accountId string, in * return &out.Account, nil } func (h *AccountHandler) AccountPaymentMethodDelete(ctx context.Context, accountId string, cardId string) error { - path := fmt.Sprintf("/v1/account/%s/payment_method/%s", accountId, cardId) + path := fmt.Sprintf("/v1/account/%s/payment_method/%s", url.PathEscape(accountId), url.PathEscape(cardId)) _, err := h.doer.Do(ctx, "AccountPaymentMethodDelete", "DELETE", path, nil) return err } func (h *AccountHandler) AccountPaymentMethodsList(ctx context.Context, accountId string) ([]CardOut, error) { - path := fmt.Sprintf("/v1/account/%s/payment_methods", accountId) + path := fmt.Sprintf("/v1/account/%s/payment_methods", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountPaymentMethodsList", "GET", path, nil) if err != nil { return nil, err @@ -208,7 +209,7 @@ func (h *AccountHandler) AccountPaymentMethodsList(ctx context.Context, accountI return out.Cards, nil } func (h *AccountHandler) AccountProjectsList(ctx context.Context, accountId string) (*AccountProjectsListOut, error) { - path := fmt.Sprintf("/v1/account/%s/projects", accountId) + path := fmt.Sprintf("/v1/account/%s/projects", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountProjectsList", "GET", path, nil) if err != nil { return nil, err @@ -221,7 +222,7 @@ func (h *AccountHandler) AccountProjectsList(ctx context.Context, accountId stri return out, nil } func (h *AccountHandler) AccountUpdate(ctx context.Context, accountId string, in *AccountUpdateIn) (*AccountUpdateOut, error) { - path := fmt.Sprintf("/v1/account/%s", accountId) + path := fmt.Sprintf("/v1/account/%s", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountUpdate", "PUT", path, in) if err != nil { return nil, err @@ -234,7 +235,7 @@ func (h *AccountHandler) AccountUpdate(ctx context.Context, accountId string, in return &out.Account, nil } func (h *AccountHandler) AccountUserProjectsList(ctx context.Context, accountId string, userId string) ([]UserProjectOut, error) { - path := fmt.Sprintf("/v1/account/%s/user/%s/projects", accountId, userId) + path := fmt.Sprintf("/v1/account/%s/user/%s/projects", url.PathEscape(accountId), url.PathEscape(userId)) b, err := h.doer.Do(ctx, "AccountUserProjectsList", "GET", path, nil) if err != nil { return nil, err @@ -247,7 +248,7 @@ func (h *AccountHandler) AccountUserProjectsList(ctx context.Context, accountId return out.UserProjects, nil } func (h *AccountHandler) AccountUsersSearch(ctx context.Context, accountId string, in *AccountUsersSearchIn) ([]UserOut, error) { - path := fmt.Sprintf("/v1/account/%s/users/search", accountId) + path := fmt.Sprintf("/v1/account/%s/users/search", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountUsersSearch", "POST", path, in) if err != nil { return nil, err diff --git a/handler/accountauthentication/accountauthentication.go b/handler/accountauthentication/accountauthentication.go index c743c9f..ebf1e91 100644 --- a/handler/accountauthentication/accountauthentication.go +++ b/handler/accountauthentication/accountauthentication.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -49,7 +50,7 @@ type AccountAuthenticationHandler struct { } func (h *AccountAuthenticationHandler) AccountAuthenticationMethodCreate(ctx context.Context, accountId string, in *AccountAuthenticationMethodCreateIn) (*AccountAuthenticationMethodCreateOut, error) { - path := fmt.Sprintf("/v1/account/%s/authentication", accountId) + path := fmt.Sprintf("/v1/account/%s/authentication", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountAuthenticationMethodCreate", "POST", path, in) if err != nil { return nil, err @@ -62,12 +63,12 @@ func (h *AccountAuthenticationHandler) AccountAuthenticationMethodCreate(ctx con return &out.AuthenticationMethod, nil } func (h *AccountAuthenticationHandler) AccountAuthenticationMethodDelete(ctx context.Context, accountId string, accountAuthenticationMethodId string) error { - path := fmt.Sprintf("/v1/account/%s/authentication/%s", accountId, accountAuthenticationMethodId) + path := fmt.Sprintf("/v1/account/%s/authentication/%s", url.PathEscape(accountId), url.PathEscape(accountAuthenticationMethodId)) _, err := h.doer.Do(ctx, "AccountAuthenticationMethodDelete", "DELETE", path, nil) return err } func (h *AccountAuthenticationHandler) AccountAuthenticationMethodGet(ctx context.Context, accountId string, accountAuthenticationMethodId string) (*AccountAuthenticationMethodGetOut, error) { - path := fmt.Sprintf("/v1/account/%s/authentication/%s", accountId, accountAuthenticationMethodId) + path := fmt.Sprintf("/v1/account/%s/authentication/%s", url.PathEscape(accountId), url.PathEscape(accountAuthenticationMethodId)) b, err := h.doer.Do(ctx, "AccountAuthenticationMethodGet", "GET", path, nil) if err != nil { return nil, err @@ -80,7 +81,7 @@ func (h *AccountAuthenticationHandler) AccountAuthenticationMethodGet(ctx contex return &out.AuthenticationMethod, nil } func (h *AccountAuthenticationHandler) AccountAuthenticationMethodUpdate(ctx context.Context, accountId string, accountAuthenticationMethodId string, in *AccountAuthenticationMethodUpdateIn) (*AccountAuthenticationMethodUpdateOut, error) { - path := fmt.Sprintf("/v1/account/%s/authentication/%s", accountId, accountAuthenticationMethodId) + path := fmt.Sprintf("/v1/account/%s/authentication/%s", url.PathEscape(accountId), url.PathEscape(accountAuthenticationMethodId)) b, err := h.doer.Do(ctx, "AccountAuthenticationMethodUpdate", "PUT", path, in) if err != nil { return nil, err @@ -93,7 +94,7 @@ func (h *AccountAuthenticationHandler) AccountAuthenticationMethodUpdate(ctx con return &out.AuthenticationMethod, nil } func (h *AccountAuthenticationHandler) AccountAuthenticationMethodsList(ctx context.Context, accountId string) ([]AuthenticationMethodOut, error) { - path := fmt.Sprintf("/v1/account/%s/authentication", accountId) + path := fmt.Sprintf("/v1/account/%s/authentication", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountAuthenticationMethodsList", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/accountteam/accountteam.go b/handler/accountteam/accountteam.go index b3d9c96..3414d3d 100644 --- a/handler/accountteam/accountteam.go +++ b/handler/accountteam/accountteam.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -64,12 +65,12 @@ type AccountTeamHandler struct { } func (h *AccountTeamHandler) AccountTeamDelete(ctx context.Context, accountId string, teamId string) error { - path := fmt.Sprintf("/v1/account/%s/team/%s", accountId, teamId) + path := fmt.Sprintf("/v1/account/%s/team/%s", url.PathEscape(accountId), url.PathEscape(teamId)) _, err := h.doer.Do(ctx, "AccountTeamDelete", "DELETE", path, nil) return err } func (h *AccountTeamHandler) AccountTeamGet(ctx context.Context, accountId string, teamId string) (*AccountTeamGetOut, error) { - path := fmt.Sprintf("/v1/account/%s/team/%s", accountId, teamId) + path := fmt.Sprintf("/v1/account/%s/team/%s", url.PathEscape(accountId), url.PathEscape(teamId)) b, err := h.doer.Do(ctx, "AccountTeamGet", "GET", path, nil) if err != nil { return nil, err @@ -82,7 +83,7 @@ func (h *AccountTeamHandler) AccountTeamGet(ctx context.Context, accountId strin return &out.Team, nil } func (h *AccountTeamHandler) AccountTeamInvitesList(ctx context.Context, accountId string, teamId string) ([]AccountInviteOut, error) { - path := fmt.Sprintf("/v1/account/%s/team/%s/invites", accountId, teamId) + path := fmt.Sprintf("/v1/account/%s/team/%s/invites", url.PathEscape(accountId), url.PathEscape(teamId)) b, err := h.doer.Do(ctx, "AccountTeamInvitesList", "GET", path, nil) if err != nil { return nil, err @@ -95,7 +96,7 @@ func (h *AccountTeamHandler) AccountTeamInvitesList(ctx context.Context, account return out.AccountInvites, nil } func (h *AccountTeamHandler) AccountTeamList(ctx context.Context, accountId string) ([]TeamOut, error) { - path := fmt.Sprintf("/v1/account/%s/teams", accountId) + path := fmt.Sprintf("/v1/account/%s/teams", url.PathEscape(accountId)) b, err := h.doer.Do(ctx, "AccountTeamList", "GET", path, nil) if err != nil { return nil, err @@ -108,17 +109,17 @@ func (h *AccountTeamHandler) AccountTeamList(ctx context.Context, accountId stri return out.Teams, nil } func (h *AccountTeamHandler) AccountTeamProjectAssociate(ctx context.Context, accountId string, teamId string, project string, in *AccountTeamProjectAssociateIn) error { - path := fmt.Sprintf("/v1/account/%s/team/%s/project/%s", accountId, teamId, project) + path := fmt.Sprintf("/v1/account/%s/team/%s/project/%s", url.PathEscape(accountId), url.PathEscape(teamId), url.PathEscape(project)) _, err := h.doer.Do(ctx, "AccountTeamProjectAssociate", "POST", path, in) return err } func (h *AccountTeamHandler) AccountTeamProjectDisassociate(ctx context.Context, accountId string, teamId string, project string) error { - path := fmt.Sprintf("/v1/account/%s/team/%s/project/%s", accountId, teamId, project) + path := fmt.Sprintf("/v1/account/%s/team/%s/project/%s", url.PathEscape(accountId), url.PathEscape(teamId), url.PathEscape(project)) _, 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) + path := fmt.Sprintf("/v1/account/%s/team/%s/projects", url.PathEscape(accountId), url.PathEscape(teamId)) b, err := h.doer.Do(ctx, "AccountTeamProjectList", "GET", path, nil) if err != nil { return nil, err @@ -131,7 +132,7 @@ func (h *AccountTeamHandler) AccountTeamProjectList(ctx context.Context, account 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) + path := fmt.Sprintf("/v1/account/%s/team/%s", url.PathEscape(accountId), url.PathEscape(teamId)) b, err := h.doer.Do(ctx, "AccountTeamUpdate", "PUT", path, in) if err != nil { return nil, err diff --git a/handler/accountteammember/accountteammember.go b/handler/accountteammember/accountteammember.go index 377558a..6cc7d76 100644 --- a/handler/accountteammember/accountteammember.go +++ b/handler/accountteammember/accountteammember.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -44,12 +45,12 @@ type AccountTeamMemberHandler struct { } func (h *AccountTeamMemberHandler) AccountTeamMemberCancelInvite(ctx context.Context, accountId string, teamId string, userEmail string) error { - path := fmt.Sprintf("/v1/account/%s/team/%s/invites/%s", accountId, teamId, userEmail) + path := fmt.Sprintf("/v1/account/%s/team/%s/invites/%s", url.PathEscape(accountId), url.PathEscape(teamId), url.PathEscape(userEmail)) _, err := h.doer.Do(ctx, "AccountTeamMemberCancelInvite", "DELETE", path, nil) return err } func (h *AccountTeamMemberHandler) AccountTeamMemberVerifyInvite(ctx context.Context, accountId string, inviteVerificationCode string) (*AccountTeamMemberVerifyInviteOut, error) { - path := fmt.Sprintf("/v1/account/%s/invite/%s", accountId, inviteVerificationCode) + path := fmt.Sprintf("/v1/account/%s/invite/%s", url.PathEscape(accountId), url.PathEscape(inviteVerificationCode)) b, err := h.doer.Do(ctx, "AccountTeamMemberVerifyInvite", "POST", path, nil) if err != nil { return nil, err @@ -62,12 +63,12 @@ func (h *AccountTeamMemberHandler) AccountTeamMemberVerifyInvite(ctx context.Con return &out.InviteDetails, nil } func (h *AccountTeamMemberHandler) AccountTeamMembersInvite(ctx context.Context, accountId string, teamId string, in *AccountTeamMembersInviteIn) error { - path := fmt.Sprintf("/v1/account/%s/team/%s/members", accountId, teamId) + path := fmt.Sprintf("/v1/account/%s/team/%s/members", url.PathEscape(accountId), url.PathEscape(teamId)) _, err := h.doer.Do(ctx, "AccountTeamMembersInvite", "POST", path, in) return err } func (h *AccountTeamMemberHandler) AccountTeamMembersList(ctx context.Context, accountId string, teamId string) ([]MemberOut, error) { - path := fmt.Sprintf("/v1/account/%s/team/%s/members", accountId, teamId) + path := fmt.Sprintf("/v1/account/%s/team/%s/members", url.PathEscape(accountId), url.PathEscape(teamId)) b, err := h.doer.Do(ctx, "AccountTeamMembersList", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/applicationuser/applicationuser.go b/handler/applicationuser/applicationuser.go index 8ed480c..7bb0cf0 100644 --- a/handler/applicationuser/applicationuser.go +++ b/handler/applicationuser/applicationuser.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -59,7 +60,7 @@ type ApplicationUserHandler struct { } 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) + path := fmt.Sprintf("/v1/organization/%s/application-users/%s/access-tokens", url.PathEscape(organizationId), url.PathEscape(userId)) b, err := h.doer.Do(ctx, "ApplicationUserAccessTokenCreate", "POST", path, in) if err != nil { return nil, err @@ -72,12 +73,12 @@ func (h *ApplicationUserHandler) ApplicationUserAccessTokenCreate(ctx context.Co 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) + path := fmt.Sprintf("/v1/organization/%s/application-users/%s/access-tokens/%s", url.PathEscape(organizationId), url.PathEscape(userId), url.PathEscape(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) + path := fmt.Sprintf("/v1/organization/%s/application-users/%s/access-tokens", url.PathEscape(organizationId), url.PathEscape(userId)) b, err := h.doer.Do(ctx, "ApplicationUserAccessTokensList", "GET", path, nil) if err != nil { return nil, err @@ -90,7 +91,7 @@ func (h *ApplicationUserHandler) ApplicationUserAccessTokensList(ctx context.Con 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) + path := fmt.Sprintf("/v1/organization/%s/application-users", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "ApplicationUserCreate", "POST", path, in) if err != nil { return nil, err @@ -103,12 +104,12 @@ func (h *ApplicationUserHandler) ApplicationUserCreate(ctx context.Context, orga 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) + path := fmt.Sprintf("/v1/organization/%s/application-users/%s", url.PathEscape(organizationId), url.PathEscape(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) + path := fmt.Sprintf("/v1/organization/%s/application-users/%s", url.PathEscape(organizationId), url.PathEscape(userId)) b, err := h.doer.Do(ctx, "ApplicationUserGet", "GET", path, nil) if err != nil { return nil, err @@ -121,7 +122,7 @@ func (h *ApplicationUserHandler) ApplicationUserGet(ctx context.Context, organiz return out, nil } func (h *ApplicationUserHandler) ApplicationUsersList(ctx context.Context, organizationId string) ([]ApplicationUserOut, error) { - path := fmt.Sprintf("/v1/organization/%s/application-users", organizationId) + path := fmt.Sprintf("/v1/organization/%s/application-users", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "ApplicationUsersList", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/billinggroup/billinggroup.go b/handler/billinggroup/billinggroup.go index 39be11b..2681bdc 100644 --- a/handler/billinggroup/billinggroup.go +++ b/handler/billinggroup/billinggroup.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -102,7 +103,7 @@ func (h *BillingGroupHandler) BillingGroupCreate(ctx context.Context, in *Billin return &out.BillingGroup, nil } func (h *BillingGroupHandler) BillingGroupCreditsClaim(ctx context.Context, billingGroupId string, in *BillingGroupCreditsClaimIn) (*BillingGroupCreditsClaimOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s/credits", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s/credits", url.PathEscape(billingGroupId)) b, err := h.doer.Do(ctx, "BillingGroupCreditsClaim", "POST", path, in) if err != nil { return nil, err @@ -115,7 +116,7 @@ func (h *BillingGroupHandler) BillingGroupCreditsClaim(ctx context.Context, bill return &out.Credit, nil } func (h *BillingGroupHandler) BillingGroupCreditsList(ctx context.Context, billingGroupId string) ([]CreditOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s/credits", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s/credits", url.PathEscape(billingGroupId)) b, err := h.doer.Do(ctx, "BillingGroupCreditsList", "GET", path, nil) if err != nil { return nil, err @@ -128,12 +129,12 @@ func (h *BillingGroupHandler) BillingGroupCreditsList(ctx context.Context, billi return out.Credits, nil } func (h *BillingGroupHandler) BillingGroupDelete(ctx context.Context, billingGroupId string) error { - path := fmt.Sprintf("/v1/billing-group/%s", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s", url.PathEscape(billingGroupId)) _, err := h.doer.Do(ctx, "BillingGroupDelete", "DELETE", path, nil) return err } func (h *BillingGroupHandler) BillingGroupEventList(ctx context.Context, billingGroupId string) ([]EventOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s/events", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s/events", url.PathEscape(billingGroupId)) b, err := h.doer.Do(ctx, "BillingGroupEventList", "GET", path, nil) if err != nil { return nil, err @@ -146,7 +147,7 @@ func (h *BillingGroupHandler) BillingGroupEventList(ctx context.Context, billing return out.Events, nil } func (h *BillingGroupHandler) BillingGroupGet(ctx context.Context, billingGroupId string) (*BillingGroupGetOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s", url.PathEscape(billingGroupId)) b, err := h.doer.Do(ctx, "BillingGroupGet", "GET", path, nil) if err != nil { return nil, err @@ -159,7 +160,7 @@ func (h *BillingGroupHandler) BillingGroupGet(ctx context.Context, billingGroupI return &out.BillingGroup, nil } func (h *BillingGroupHandler) BillingGroupInvoiceLinesList(ctx context.Context, billingGroupId string, invoiceNumber string) ([]LineOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s/invoice/%s/lines", billingGroupId, invoiceNumber) + path := fmt.Sprintf("/v1/billing-group/%s/invoice/%s/lines", url.PathEscape(billingGroupId), url.PathEscape(invoiceNumber)) b, err := h.doer.Do(ctx, "BillingGroupInvoiceLinesList", "GET", path, nil) if err != nil { return nil, err @@ -172,7 +173,7 @@ func (h *BillingGroupHandler) BillingGroupInvoiceLinesList(ctx context.Context, return out.Lines, nil } func (h *BillingGroupHandler) BillingGroupInvoiceList(ctx context.Context, billingGroupId string) ([]InvoiceOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s/invoice", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s/invoice", url.PathEscape(billingGroupId)) b, err := h.doer.Do(ctx, "BillingGroupInvoiceList", "GET", path, nil) if err != nil { return nil, err @@ -198,12 +199,12 @@ func (h *BillingGroupHandler) BillingGroupList(ctx context.Context) ([]BillingGr return out.BillingGroups, nil } func (h *BillingGroupHandler) BillingGroupProjectAssign(ctx context.Context, billingGroupId string, project string) error { - path := fmt.Sprintf("/v1/billing-group/%s/project-assign/%s", billingGroupId, project) + path := fmt.Sprintf("/v1/billing-group/%s/project-assign/%s", url.PathEscape(billingGroupId), url.PathEscape(project)) _, err := h.doer.Do(ctx, "BillingGroupProjectAssign", "POST", path, nil) return err } func (h *BillingGroupHandler) BillingGroupProjectList(ctx context.Context, billingGroupId string) ([]ProjectOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s/projects", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s/projects", url.PathEscape(billingGroupId)) b, err := h.doer.Do(ctx, "BillingGroupProjectList", "GET", path, nil) if err != nil { return nil, err @@ -216,12 +217,12 @@ func (h *BillingGroupHandler) BillingGroupProjectList(ctx context.Context, billi return out.Projects, nil } func (h *BillingGroupHandler) BillingGroupProjectsAssign(ctx context.Context, billingGroupId string, in *BillingGroupProjectsAssignIn) error { - path := fmt.Sprintf("/v1/billing-group/%s/projects-assign", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s/projects-assign", url.PathEscape(billingGroupId)) _, err := h.doer.Do(ctx, "BillingGroupProjectsAssign", "POST", path, in) return err } func (h *BillingGroupHandler) BillingGroupUpdate(ctx context.Context, billingGroupId string, in *BillingGroupUpdateIn) (*BillingGroupUpdateOut, error) { - path := fmt.Sprintf("/v1/billing-group/%s", billingGroupId) + path := fmt.Sprintf("/v1/billing-group/%s", url.PathEscape(billingGroupId)) b, err := h.doer.Do(ctx, "BillingGroupUpdate", "PUT", path, in) if err != nil { return nil, err diff --git a/handler/clickhouse/clickhouse.go b/handler/clickhouse/clickhouse.go index 57c8859..b817046 100644 --- a/handler/clickhouse/clickhouse.go +++ b/handler/clickhouse/clickhouse.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -48,17 +49,17 @@ type ClickHouseHandler struct { } func (h *ClickHouseHandler) ServiceClickHouseDatabaseCreate(ctx context.Context, project string, serviceName string, in *ServiceClickHouseDatabaseCreateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/db", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/db", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceClickHouseDatabaseCreate", "POST", path, in) return err } func (h *ClickHouseHandler) ServiceClickHouseDatabaseDelete(ctx context.Context, project string, serviceName string, database string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/db/%s", project, serviceName, database) + path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/db/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(database)) _, 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) + path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/db", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceClickHouseDatabaseList", "GET", path, nil) if err != nil { return nil, err @@ -71,7 +72,7 @@ func (h *ClickHouseHandler) ServiceClickHouseDatabaseList(ctx context.Context, p 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) + path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/query/stats", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceClickHouseQueryStats", "GET", path, nil) if err != nil { return nil, err @@ -84,7 +85,7 @@ func (h *ClickHouseHandler) ServiceClickHouseQueryStats(ctx context.Context, pro return out.Queries, nil } func (h *ClickHouseHandler) ServiceClickHouseTieredStorageSummary(ctx context.Context, project string, serviceName string) (*ServiceClickHouseTieredStorageSummaryOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/tiered-storage/summary", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/clickhouse/tiered-storage/summary", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceClickHouseTieredStorageSummary", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/cloud/cloud.go b/handler/cloud/cloud.go index 3df3c04..ddb05d0 100644 --- a/handler/cloud/cloud.go +++ b/handler/cloud/cloud.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -46,7 +47,7 @@ func (h *CloudHandler) ListClouds(ctx context.Context) ([]CloudOut, error) { return out.Clouds, nil } func (h *CloudHandler) ListProjectClouds(ctx context.Context, project string) ([]CloudOut, error) { - path := fmt.Sprintf("/v1/project/%s/clouds", project) + path := fmt.Sprintf("/v1/project/%s/clouds", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ListProjectClouds", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/domain/domain.go b/handler/domain/domain.go index 6a09e2e..0a0b0cf 100644 --- a/handler/domain/domain.go +++ b/handler/domain/domain.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -49,7 +50,7 @@ type DomainHandler struct { } func (h *DomainHandler) OrganizationDomainAdd(ctx context.Context, organizationId string, in *OrganizationDomainAddIn) (*OrganizationDomainAddOut, error) { - path := fmt.Sprintf("/v1/organization/%s/domains", organizationId) + path := fmt.Sprintf("/v1/organization/%s/domains", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationDomainAdd", "POST", path, in) if err != nil { return nil, err @@ -62,7 +63,7 @@ func (h *DomainHandler) OrganizationDomainAdd(ctx context.Context, organizationI return out, nil } func (h *DomainHandler) OrganizationDomainUpdate(ctx context.Context, organizationId string, domainId string, in *OrganizationDomainUpdateIn) (*OrganizationDomainUpdateOut, error) { - path := fmt.Sprintf("/v1/organization/%s/domains/%s", organizationId, domainId) + path := fmt.Sprintf("/v1/organization/%s/domains/%s", url.PathEscape(organizationId), url.PathEscape(domainId)) b, err := h.doer.Do(ctx, "OrganizationDomainUpdate", "PATCH", path, in) if err != nil { return nil, err @@ -75,7 +76,7 @@ func (h *DomainHandler) OrganizationDomainUpdate(ctx context.Context, organizati return out, nil } func (h *DomainHandler) OrganizationDomainVerify(ctx context.Context, organizationId string, domainId string) (*OrganizationDomainVerifyOut, error) { - path := fmt.Sprintf("/v1/organization/%s/domains/%s/verify", organizationId, domainId) + path := fmt.Sprintf("/v1/organization/%s/domains/%s/verify", url.PathEscape(organizationId), url.PathEscape(domainId)) b, err := h.doer.Do(ctx, "OrganizationDomainVerify", "POST", path, nil) if err != nil { return nil, err @@ -88,7 +89,7 @@ func (h *DomainHandler) OrganizationDomainVerify(ctx context.Context, organizati return out, nil } func (h *DomainHandler) OrganizationDomainsList(ctx context.Context, organizationId string) ([]DomainOut, error) { - path := fmt.Sprintf("/v1/organization/%s/domains", organizationId) + path := fmt.Sprintf("/v1/organization/%s/domains", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationDomainsList", "GET", path, nil) if err != nil { return nil, err @@ -101,7 +102,7 @@ func (h *DomainHandler) OrganizationDomainsList(ctx context.Context, organizatio return out.Domains, nil } func (h *DomainHandler) OrganizationDomainsRemove(ctx context.Context, organizationId string, domainId string) error { - path := fmt.Sprintf("/v1/organization/%s/domains/%s", organizationId, domainId) + path := fmt.Sprintf("/v1/organization/%s/domains/%s", url.PathEscape(organizationId), url.PathEscape(domainId)) _, err := h.doer.Do(ctx, "OrganizationDomainsRemove", "DELETE", path, nil) return err } diff --git a/handler/flink/flink.go b/handler/flink/flink.go index 6cf8d9c..a2ff45f 100644 --- a/handler/flink/flink.go +++ b/handler/flink/flink.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -28,7 +29,7 @@ type FlinkHandler struct { } func (h *FlinkHandler) ServiceFlinkOverview(ctx context.Context, project string, serviceName string) (*ServiceFlinkOverviewOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/overview", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/overview", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceFlinkOverview", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/flinkapplication/flinkapplication.go b/handler/flinkapplication/flinkapplication.go index 2714cb4..eae8998 100644 --- a/handler/flinkapplication/flinkapplication.go +++ b/handler/flinkapplication/flinkapplication.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -49,7 +50,7 @@ type FlinkApplicationHandler struct { } func (h *FlinkApplicationHandler) ServiceFlinkCreateApplication(ctx context.Context, project string, serviceName string, in *ServiceFlinkCreateApplicationIn) (*ServiceFlinkCreateApplicationOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceFlinkCreateApplication", "POST", path, in) if err != nil { return nil, err @@ -62,7 +63,7 @@ func (h *FlinkApplicationHandler) ServiceFlinkCreateApplication(ctx context.Cont return out, nil } func (h *FlinkApplicationHandler) ServiceFlinkDeleteApplication(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkDeleteApplicationOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s", project, serviceName, applicationId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) b, err := h.doer.Do(ctx, "ServiceFlinkDeleteApplication", "DELETE", path, nil) if err != nil { return nil, err @@ -75,7 +76,7 @@ func (h *FlinkApplicationHandler) ServiceFlinkDeleteApplication(ctx context.Cont return out, nil } func (h *FlinkApplicationHandler) ServiceFlinkGetApplication(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkGetApplicationOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s", project, serviceName, applicationId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) b, err := h.doer.Do(ctx, "ServiceFlinkGetApplication", "GET", path, nil) if err != nil { return nil, err @@ -88,7 +89,7 @@ func (h *FlinkApplicationHandler) ServiceFlinkGetApplication(ctx context.Context return out, nil } func (h *FlinkApplicationHandler) ServiceFlinkListApplications(ctx context.Context, project string, serviceName string) ([]ApplicationOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceFlinkListApplications", "GET", path, nil) if err != nil { return nil, err @@ -101,7 +102,7 @@ func (h *FlinkApplicationHandler) ServiceFlinkListApplications(ctx context.Conte return out.Applications, nil } func (h *FlinkApplicationHandler) ServiceFlinkUpdateApplication(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkUpdateApplicationIn) (*ServiceFlinkUpdateApplicationOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s", project, serviceName, applicationId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) b, err := h.doer.Do(ctx, "ServiceFlinkUpdateApplication", "PUT", path, in) if err != nil { return nil, err diff --git a/handler/flinkapplicationdeployment/flinkapplicationdeployment.go b/handler/flinkapplicationdeployment/flinkapplicationdeployment.go index 209e2b8..a61bcf6 100644 --- a/handler/flinkapplicationdeployment/flinkapplicationdeployment.go +++ b/handler/flinkapplicationdeployment/flinkapplicationdeployment.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -54,7 +55,7 @@ type FlinkApplicationDeploymentHandler struct { } func (h *FlinkApplicationDeploymentHandler) ServiceFlinkCancelApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkCancelApplicationDeploymentOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s/cancel", project, serviceName, applicationId, deploymentId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s/cancel", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) b, err := h.doer.Do(ctx, "ServiceFlinkCancelApplicationDeployment", "POST", path, nil) if err != nil { return nil, err @@ -67,7 +68,7 @@ func (h *FlinkApplicationDeploymentHandler) ServiceFlinkCancelApplicationDeploym return out, nil } func (h *FlinkApplicationDeploymentHandler) ServiceFlinkCreateApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkCreateApplicationDeploymentIn) (*ServiceFlinkCreateApplicationDeploymentOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment", project, serviceName, applicationId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) b, err := h.doer.Do(ctx, "ServiceFlinkCreateApplicationDeployment", "POST", path, in) if err != nil { return nil, err @@ -80,7 +81,7 @@ func (h *FlinkApplicationDeploymentHandler) ServiceFlinkCreateApplicationDeploym return out, nil } func (h *FlinkApplicationDeploymentHandler) ServiceFlinkDeleteApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkDeleteApplicationDeploymentOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s", project, serviceName, applicationId, deploymentId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) b, err := h.doer.Do(ctx, "ServiceFlinkDeleteApplicationDeployment", "DELETE", path, nil) if err != nil { return nil, err @@ -93,7 +94,7 @@ func (h *FlinkApplicationDeploymentHandler) ServiceFlinkDeleteApplicationDeploym return out, nil } func (h *FlinkApplicationDeploymentHandler) ServiceFlinkGetApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkGetApplicationDeploymentOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s", project, serviceName, applicationId, deploymentId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) b, err := h.doer.Do(ctx, "ServiceFlinkGetApplicationDeployment", "GET", path, nil) if err != nil { return nil, err @@ -106,7 +107,7 @@ func (h *FlinkApplicationDeploymentHandler) ServiceFlinkGetApplicationDeployment return out, nil } func (h *FlinkApplicationDeploymentHandler) ServiceFlinkListApplicationDeployments(ctx context.Context, project string, serviceName string, applicationId string) ([]DeploymentOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment", project, serviceName, applicationId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) b, err := h.doer.Do(ctx, "ServiceFlinkListApplicationDeployments", "GET", path, nil) if err != nil { return nil, err @@ -119,7 +120,7 @@ func (h *FlinkApplicationDeploymentHandler) ServiceFlinkListApplicationDeploymen return out.Deployments, nil } func (h *FlinkApplicationDeploymentHandler) ServiceFlinkStopApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkStopApplicationDeploymentOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s/stop", project, serviceName, applicationId, deploymentId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/deployment/%s/stop", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) b, err := h.doer.Do(ctx, "ServiceFlinkStopApplicationDeployment", "POST", path, nil) if err != nil { return nil, err diff --git a/handler/flinkapplicationversion/flinkapplicationversion.go b/handler/flinkapplicationversion/flinkapplicationversion.go index 74ac818..4a98bfe 100644 --- a/handler/flinkapplicationversion/flinkapplicationversion.go +++ b/handler/flinkapplicationversion/flinkapplicationversion.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -44,7 +45,7 @@ type FlinkApplicationVersionHandler struct { } func (h *FlinkApplicationVersionHandler) ServiceFlinkCreateApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkCreateApplicationVersionIn) (*ServiceFlinkCreateApplicationVersionOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version", project, serviceName, applicationId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) b, err := h.doer.Do(ctx, "ServiceFlinkCreateApplicationVersion", "POST", path, in) if err != nil { return nil, err @@ -57,7 +58,7 @@ func (h *FlinkApplicationVersionHandler) ServiceFlinkCreateApplicationVersion(ct return out, nil } func (h *FlinkApplicationVersionHandler) ServiceFlinkDeleteApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, applicationVersionId string) (*ServiceFlinkDeleteApplicationVersionOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version/%s", project, serviceName, applicationId, applicationVersionId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(applicationVersionId)) b, err := h.doer.Do(ctx, "ServiceFlinkDeleteApplicationVersion", "DELETE", path, nil) if err != nil { return nil, err @@ -70,7 +71,7 @@ func (h *FlinkApplicationVersionHandler) ServiceFlinkDeleteApplicationVersion(ct return out, nil } func (h *FlinkApplicationVersionHandler) ServiceFlinkGetApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, applicationVersionId string) (*ServiceFlinkGetApplicationVersionOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version/%s", project, serviceName, applicationId, applicationVersionId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(applicationVersionId)) b, err := h.doer.Do(ctx, "ServiceFlinkGetApplicationVersion", "GET", path, nil) if err != nil { return nil, err @@ -83,7 +84,7 @@ func (h *FlinkApplicationVersionHandler) ServiceFlinkGetApplicationVersion(ctx c return out, nil } func (h *FlinkApplicationVersionHandler) ServiceFlinkValidateApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkValidateApplicationVersionIn) (*ServiceFlinkValidateApplicationVersionOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version/validate", project, serviceName, applicationId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/application/%s/version/validate", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) b, err := h.doer.Do(ctx, "ServiceFlinkValidateApplicationVersion", "POST", path, in) if err != nil { return nil, err diff --git a/handler/flinkjob/flinkjob.go b/handler/flinkjob/flinkjob.go index cc10a1d..f6a3566 100644 --- a/handler/flinkjob/flinkjob.go +++ b/handler/flinkjob/flinkjob.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -33,7 +34,7 @@ type FlinkJobHandler struct { } func (h *FlinkJobHandler) ServiceFlinkJobDetails(ctx context.Context, project string, serviceName string, jobId string) (*ServiceFlinkJobDetailsOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/job/%s", project, serviceName, jobId) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/job/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(jobId)) b, err := h.doer.Do(ctx, "ServiceFlinkJobDetails", "GET", path, nil) if err != nil { return nil, err @@ -46,7 +47,7 @@ func (h *FlinkJobHandler) ServiceFlinkJobDetails(ctx context.Context, project st return out, nil } func (h *FlinkJobHandler) ServiceFlinkJobsList(ctx context.Context, project string, serviceName string) ([]JobOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/flink/job", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/job", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceFlinkJobsList", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/kafka/kafka.go b/handler/kafka/kafka.go index f21d739..6323bfa 100644 --- a/handler/kafka/kafka.go +++ b/handler/kafka/kafka.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -73,7 +74,7 @@ type KafkaHandler struct { } func (h *KafkaHandler) ServiceKafkaAclAdd(ctx context.Context, project string, serviceName string, in *ServiceKafkaAclAddIn) ([]AclOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/acl", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/acl", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaAclAdd", "POST", path, in) if err != nil { return nil, err @@ -86,7 +87,7 @@ func (h *KafkaHandler) ServiceKafkaAclAdd(ctx context.Context, project string, s return out.Acl, nil } func (h *KafkaHandler) ServiceKafkaAclDelete(ctx context.Context, project string, serviceName string, kafkaAclId string) ([]AclOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/acl/%s", project, serviceName, kafkaAclId) + path := fmt.Sprintf("/v1/project/%s/service/%s/acl/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(kafkaAclId)) b, err := h.doer.Do(ctx, "ServiceKafkaAclDelete", "DELETE", path, nil) if err != nil { return nil, err @@ -99,7 +100,7 @@ func (h *KafkaHandler) ServiceKafkaAclDelete(ctx context.Context, project string return out.Acl, nil } func (h *KafkaHandler) ServiceKafkaAclList(ctx context.Context, project string, serviceName string) ([]AclOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/acl", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/acl", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaAclList", "GET", path, nil) if err != nil { return nil, err @@ -112,17 +113,17 @@ func (h *KafkaHandler) ServiceKafkaAclList(ctx context.Context, project string, return out.Acl, nil } func (h *KafkaHandler) ServiceKafkaQuotaCreate(ctx context.Context, project string, serviceName string, in *ServiceKafkaQuotaCreateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/quota", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/quota", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceKafkaQuotaCreate", "POST", path, in) return err } func (h *KafkaHandler) ServiceKafkaQuotaDelete(ctx context.Context, project string, serviceName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/quota", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/quota", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceKafkaQuotaDelete", "DELETE", path, nil) return err } func (h *KafkaHandler) ServiceKafkaQuotaDescribe(ctx context.Context, project string, serviceName string) (*ServiceKafkaQuotaDescribeOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/quota/describe", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/quota/describe", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaQuotaDescribe", "GET", path, nil) if err != nil { return nil, err @@ -135,7 +136,7 @@ func (h *KafkaHandler) ServiceKafkaQuotaDescribe(ctx context.Context, project st return &out.Quota, nil } func (h *KafkaHandler) ServiceKafkaQuotaList(ctx context.Context, project string, serviceName string) ([]QuotaOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/quota", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/quota", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaQuotaList", "GET", path, nil) if err != nil { return nil, err @@ -148,7 +149,7 @@ func (h *KafkaHandler) ServiceKafkaQuotaList(ctx context.Context, project string return out.Quotas, nil } func (h *KafkaHandler) ServiceKafkaTieredStorageStorageUsageByTopic(ctx context.Context, project string, serviceName string) (map[string]any, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/tiered-storage/storage-usage/by-topic", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/tiered-storage/storage-usage/by-topic", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaTieredStorageStorageUsageByTopic", "GET", path, nil) if err != nil { return nil, err @@ -161,7 +162,7 @@ func (h *KafkaHandler) ServiceKafkaTieredStorageStorageUsageByTopic(ctx context. return out.StorageUsage, nil } func (h *KafkaHandler) ServiceKafkaTieredStorageStorageUsageTotal(ctx context.Context, project string, serviceName string) (int, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/tiered-storage/storage-usage/total", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/tiered-storage/storage-usage/total", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaTieredStorageStorageUsageTotal", "GET", path, nil) if err != nil { return 0, err @@ -174,7 +175,7 @@ func (h *KafkaHandler) ServiceKafkaTieredStorageStorageUsageTotal(ctx context.Co return out.TotalStorageUsage, nil } func (h *KafkaHandler) ServiceKafkaTieredStorageSummary(ctx context.Context, project string, serviceName string) (*ServiceKafkaTieredStorageSummaryOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/tiered-storage/summary", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/tiered-storage/summary", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaTieredStorageSummary", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/kafkaconnect/kafkaconnect.go b/handler/kafkaconnect/kafkaconnect.go index ad64003..fc651e3 100644 --- a/handler/kafkaconnect/kafkaconnect.go +++ b/handler/kafkaconnect/kafkaconnect.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -78,7 +79,7 @@ type KafkaConnectHandler struct { } func (h *KafkaConnectHandler) ServiceKafkaConnectCreateConnector(ctx context.Context, project string, serviceName string, in *ServiceKafkaConnectCreateConnectorIn) (*ServiceKafkaConnectCreateConnectorOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaConnectCreateConnector", "POST", path, in) if err != nil { return nil, err @@ -91,12 +92,12 @@ func (h *KafkaConnectHandler) ServiceKafkaConnectCreateConnector(ctx context.Con return &out.Connector, nil } func (h *KafkaConnectHandler) ServiceKafkaConnectDeleteConnector(ctx context.Context, project string, serviceName string, connectorName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s", project, serviceName, connectorName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName)) _, err := h.doer.Do(ctx, "ServiceKafkaConnectDeleteConnector", "DELETE", path, nil) return err } func (h *KafkaConnectHandler) ServiceKafkaConnectEditConnector(ctx context.Context, project string, serviceName string, connectorName string, in *ServiceKafkaConnectEditConnectorIn) (*ServiceKafkaConnectEditConnectorOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s", project, serviceName, connectorName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName)) b, err := h.doer.Do(ctx, "ServiceKafkaConnectEditConnector", "PUT", path, in) if err != nil { return nil, err @@ -109,7 +110,7 @@ func (h *KafkaConnectHandler) ServiceKafkaConnectEditConnector(ctx context.Conte return &out.Connector, nil } func (h *KafkaConnectHandler) ServiceKafkaConnectGetAvailableConnectors(ctx context.Context, project string, serviceName string) ([]PluginOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/available-connectors", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/available-connectors", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaConnectGetAvailableConnectors", "GET", path, nil) if err != nil { return nil, err @@ -122,7 +123,7 @@ func (h *KafkaConnectHandler) ServiceKafkaConnectGetAvailableConnectors(ctx cont return out.Plugins, nil } func (h *KafkaConnectHandler) ServiceKafkaConnectGetConnectorConfiguration(ctx context.Context, project string, serviceName string, connectorName string) ([]ConfigurationSchemaOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/connector-plugins/%s/configuration", project, serviceName, connectorName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connector-plugins/%s/configuration", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName)) b, err := h.doer.Do(ctx, "ServiceKafkaConnectGetConnectorConfiguration", "GET", path, nil) if err != nil { return nil, err @@ -135,7 +136,7 @@ func (h *KafkaConnectHandler) ServiceKafkaConnectGetConnectorConfiguration(ctx c return out.ConfigurationSchema, nil } func (h *KafkaConnectHandler) ServiceKafkaConnectGetConnectorStatus(ctx context.Context, project string, serviceName string, connectorName string) (*ServiceKafkaConnectGetConnectorStatusOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/status", project, serviceName, connectorName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/status", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName)) b, err := h.doer.Do(ctx, "ServiceKafkaConnectGetConnectorStatus", "GET", path, nil) if err != nil { return nil, err @@ -148,7 +149,7 @@ func (h *KafkaConnectHandler) ServiceKafkaConnectGetConnectorStatus(ctx context. return &out.Status, nil } func (h *KafkaConnectHandler) ServiceKafkaConnectList(ctx context.Context, project string, serviceName string) ([]ConnectorOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaConnectList", "GET", path, nil) if err != nil { return nil, err @@ -161,22 +162,22 @@ func (h *KafkaConnectHandler) ServiceKafkaConnectList(ctx context.Context, proje return out.Connectors, nil } func (h *KafkaConnectHandler) ServiceKafkaConnectPauseConnector(ctx context.Context, project string, serviceName string, connectorName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/pause", project, serviceName, connectorName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/pause", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName)) _, err := h.doer.Do(ctx, "ServiceKafkaConnectPauseConnector", "POST", path, nil) return err } func (h *KafkaConnectHandler) ServiceKafkaConnectRestartConnector(ctx context.Context, project string, serviceName string, connectorName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/restart", project, serviceName, connectorName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/restart", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName)) _, err := h.doer.Do(ctx, "ServiceKafkaConnectRestartConnector", "POST", path, nil) return err } func (h *KafkaConnectHandler) ServiceKafkaConnectRestartConnectorTask(ctx context.Context, project string, serviceName string, connectorName string, taskId string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/tasks/%s/restart", project, serviceName, connectorName, taskId) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/tasks/%s/restart", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName), url.PathEscape(taskId)) _, err := h.doer.Do(ctx, "ServiceKafkaConnectRestartConnectorTask", "POST", path, nil) return err } func (h *KafkaConnectHandler) ServiceKafkaConnectResumeConnector(ctx context.Context, project string, serviceName string, connectorName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/resume", project, serviceName, connectorName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connectors/%s/resume", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(connectorName)) _, err := h.doer.Do(ctx, "ServiceKafkaConnectResumeConnector", "POST", path, nil) return err } diff --git a/handler/kafkamirrormaker/kafkamirrormaker.go b/handler/kafkamirrormaker/kafkamirrormaker.go index ed55939..4795c2a 100644 --- a/handler/kafkamirrormaker/kafkamirrormaker.go +++ b/handler/kafkamirrormaker/kafkamirrormaker.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -48,17 +49,17 @@ type KafkaMirrorMakerHandler struct { } func (h *KafkaMirrorMakerHandler) ServiceKafkaMirrorMakerCreateReplicationFlow(ctx context.Context, project string, serviceName string, in *ServiceKafkaMirrorMakerCreateReplicationFlowIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceKafkaMirrorMakerCreateReplicationFlow", "POST", path, in) return err } func (h *KafkaMirrorMakerHandler) ServiceKafkaMirrorMakerDeleteReplicationFlow(ctx context.Context, project string, serviceName string, sourceCluster string, targetCluster string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows/%s/%s", project, serviceName, sourceCluster, targetCluster) + path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows/%s/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(sourceCluster), url.PathEscape(targetCluster)) _, err := h.doer.Do(ctx, "ServiceKafkaMirrorMakerDeleteReplicationFlow", "DELETE", path, nil) return err } func (h *KafkaMirrorMakerHandler) ServiceKafkaMirrorMakerGetReplicationFlow(ctx context.Context, project string, serviceName string, sourceCluster string, targetCluster string) (*ServiceKafkaMirrorMakerGetReplicationFlowOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows/%s/%s", project, serviceName, sourceCluster, targetCluster) + path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows/%s/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(sourceCluster), url.PathEscape(targetCluster)) b, err := h.doer.Do(ctx, "ServiceKafkaMirrorMakerGetReplicationFlow", "GET", path, nil) if err != nil { return nil, err @@ -71,7 +72,7 @@ func (h *KafkaMirrorMakerHandler) ServiceKafkaMirrorMakerGetReplicationFlow(ctx return &out.ReplicationFlow, nil } func (h *KafkaMirrorMakerHandler) ServiceKafkaMirrorMakerGetReplicationFlows(ctx context.Context, project string, serviceName string) ([]ReplicationFlowOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaMirrorMakerGetReplicationFlows", "GET", path, nil) if err != nil { return nil, err @@ -84,7 +85,7 @@ func (h *KafkaMirrorMakerHandler) ServiceKafkaMirrorMakerGetReplicationFlows(ctx return out.ReplicationFlows, nil } func (h *KafkaMirrorMakerHandler) ServiceKafkaMirrorMakerPatchReplicationFlow(ctx context.Context, project string, serviceName string, sourceCluster string, targetCluster string, in *ServiceKafkaMirrorMakerPatchReplicationFlowIn) (*ServiceKafkaMirrorMakerPatchReplicationFlowOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows/%s/%s", project, serviceName, sourceCluster, targetCluster) + path := fmt.Sprintf("/v1/project/%s/service/%s/mirrormaker/replication-flows/%s/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(sourceCluster), url.PathEscape(targetCluster)) b, err := h.doer.Do(ctx, "ServiceKafkaMirrorMakerPatchReplicationFlow", "PUT", path, in) if err != nil { return nil, err diff --git a/handler/kafkaschemaregistry/kafkaschemaregistry.go b/handler/kafkaschemaregistry/kafkaschemaregistry.go index f954752..a7fafee 100644 --- a/handler/kafkaschemaregistry/kafkaschemaregistry.go +++ b/handler/kafkaschemaregistry/kafkaschemaregistry.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -98,7 +99,7 @@ type KafkaSchemaRegistryHandler struct { } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryAclAdd(ctx context.Context, project string, serviceName string, in *ServiceSchemaRegistryAclAddIn) ([]AclOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema-registry/acl", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema-registry/acl", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistryAclAdd", "POST", path, in) if err != nil { return nil, err @@ -111,7 +112,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryAclAdd(ctx context.Con return out.Acl, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryAclDelete(ctx context.Context, project string, serviceName string, schemaRegistryAclId string) ([]AclOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema-registry/acl/%s", project, serviceName, schemaRegistryAclId) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema-registry/acl/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(schemaRegistryAclId)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistryAclDelete", "DELETE", path, nil) if err != nil { return nil, err @@ -124,7 +125,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryAclDelete(ctx context. return out.Acl, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryAclList(ctx context.Context, project string, serviceName string) ([]AclOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema-registry/acl", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema-registry/acl", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistryAclList", "GET", path, nil) if err != nil { return nil, err @@ -137,7 +138,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryAclList(ctx context.Co return out.Acl, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryCompatibility(ctx context.Context, project string, serviceName string, subjectName string, versionId int, in *ServiceSchemaRegistryCompatibilityIn) (bool, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/compatibility/subjects/%s/versions/%d", project, serviceName, subjectName, versionId) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/compatibility/subjects/%s/versions/%d", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName), versionId) b, err := h.doer.Do(ctx, "ServiceSchemaRegistryCompatibility", "POST", path, in) if err != nil { return false, err @@ -150,7 +151,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryCompatibility(ctx cont return out.IsCompatible, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryGlobalConfigGet(ctx context.Context, project string, serviceName string) (CompatibilityType, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistryGlobalConfigGet", "GET", path, nil) if err != nil { return "", err @@ -163,7 +164,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryGlobalConfigGet(ctx co return out.CompatibilityLevel, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryGlobalConfigPut(ctx context.Context, project string, serviceName string, in *ServiceSchemaRegistryGlobalConfigPutIn) (CompatibilityType, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistryGlobalConfigPut", "PUT", path, in) if err != nil { return "", err @@ -176,12 +177,12 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistryGlobalConfigPut(ctx co return out.Compatibility, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySchemaGet(ctx context.Context, project string, serviceName string, schemaId string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/schemas/ids/%s", project, serviceName, schemaId) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/schemas/ids/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(schemaId)) _, err := h.doer.Do(ctx, "ServiceSchemaRegistrySchemaGet", "GET", path, nil) return err } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectConfigGet(ctx context.Context, project string, serviceName string, subjectName string) (CompatibilityType, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config/%s", project, serviceName, subjectName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjectConfigGet", "GET", path, nil) if err != nil { return "", err @@ -194,7 +195,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectConfigGet(ctx c return out.CompatibilityLevel, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectConfigPut(ctx context.Context, project string, serviceName string, subjectName string, in *ServiceSchemaRegistrySubjectConfigPutIn) (CompatibilityType, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config/%s", project, serviceName, subjectName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/config/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjectConfigPut", "PUT", path, in) if err != nil { return "", err @@ -207,22 +208,22 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectConfigPut(ctx c return out.Compatibility, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectDelete(ctx context.Context, project string, serviceName string, subjectName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s", project, serviceName, subjectName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName)) _, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjectDelete", "DELETE", path, nil) return err } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectVersionDelete(ctx context.Context, project string, serviceName string, subjectName string, versionId int) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions/%d", project, serviceName, subjectName, versionId) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions/%d", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName), versionId) _, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjectVersionDelete", "DELETE", path, nil) return err } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectVersionGet(ctx context.Context, project string, serviceName string, subjectName string, versionId int) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions/%d", project, serviceName, subjectName, versionId) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions/%d", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName), versionId) _, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjectVersionGet", "GET", path, nil) return err } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectVersionPost(ctx context.Context, project string, serviceName string, subjectName string, in *ServiceSchemaRegistrySubjectVersionPostIn) (int, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions", project, serviceName, subjectName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjectVersionPost", "POST", path, in) if err != nil { return 0, err @@ -235,7 +236,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectVersionPost(ctx return out.Id, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectVersionsGet(ctx context.Context, project string, serviceName string, subjectName string) ([]int, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions", project, serviceName, subjectName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects/%s/versions", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(subjectName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjectVersionsGet", "GET", path, nil) if err != nil { return nil, err @@ -248,7 +249,7 @@ func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjectVersionsGet(ctx return out.Versions, nil } func (h *KafkaSchemaRegistryHandler) ServiceSchemaRegistrySubjects(ctx context.Context, project string, serviceName string) ([]string, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/schema/subjects", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceSchemaRegistrySubjects", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/kafkatopic/kafkatopic.go b/handler/kafkatopic/kafkatopic.go index fe8c424..866638c 100644 --- a/handler/kafkatopic/kafkatopic.go +++ b/handler/kafkatopic/kafkatopic.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -58,17 +59,17 @@ type KafkaTopicHandler struct { } func (h *KafkaTopicHandler) ServiceKafkaTopicCreate(ctx context.Context, project string, serviceName string, in *ServiceKafkaTopicCreateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/topic", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/topic", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceKafkaTopicCreate", "POST", path, in) return err } func (h *KafkaTopicHandler) ServiceKafkaTopicDelete(ctx context.Context, project string, serviceName string, topicName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/topic/%s", project, serviceName, topicName) + path := fmt.Sprintf("/v1/project/%s/service/%s/topic/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(topicName)) _, err := h.doer.Do(ctx, "ServiceKafkaTopicDelete", "DELETE", path, nil) return err } func (h *KafkaTopicHandler) ServiceKafkaTopicGet(ctx context.Context, project string, serviceName string, topicName string) (*ServiceKafkaTopicGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/topic/%s", project, serviceName, topicName) + path := fmt.Sprintf("/v1/project/%s/service/%s/topic/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(topicName)) b, err := h.doer.Do(ctx, "ServiceKafkaTopicGet", "GET", path, nil) if err != nil { return nil, err @@ -81,7 +82,7 @@ func (h *KafkaTopicHandler) ServiceKafkaTopicGet(ctx context.Context, project st return &out.Topic, nil } func (h *KafkaTopicHandler) ServiceKafkaTopicList(ctx context.Context, project string, serviceName string) ([]TopicOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/topic", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/topic", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceKafkaTopicList", "GET", path, nil) if err != nil { return nil, err @@ -94,7 +95,7 @@ func (h *KafkaTopicHandler) ServiceKafkaTopicList(ctx context.Context, project s return out.Topics, nil } func (h *KafkaTopicHandler) ServiceKafkaTopicMessageList(ctx context.Context, project string, serviceName string, topicName string, in *ServiceKafkaTopicMessageListIn) ([]MessageOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/rest/topics/%s/messages", project, serviceName, topicName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/rest/topics/%s/messages", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(topicName)) b, err := h.doer.Do(ctx, "ServiceKafkaTopicMessageList", "POST", path, in) if err != nil { return nil, err @@ -107,7 +108,7 @@ func (h *KafkaTopicHandler) ServiceKafkaTopicMessageList(ctx context.Context, pr return out.Messages, nil } func (h *KafkaTopicHandler) ServiceKafkaTopicMessageProduce(ctx context.Context, project string, serviceName string, topicName string, in *ServiceKafkaTopicMessageProduceIn) (*ServiceKafkaTopicMessageProduceOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/rest/topics/%s/produce", project, serviceName, topicName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kafka/rest/topics/%s/produce", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(topicName)) b, err := h.doer.Do(ctx, "ServiceKafkaTopicMessageProduce", "POST", path, in) if err != nil { return nil, err @@ -120,7 +121,7 @@ func (h *KafkaTopicHandler) ServiceKafkaTopicMessageProduce(ctx context.Context, return out, nil } func (h *KafkaTopicHandler) ServiceKafkaTopicUpdate(ctx context.Context, project string, serviceName string, topicName string, in *ServiceKafkaTopicUpdateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/topic/%s", project, serviceName, topicName) + path := fmt.Sprintf("/v1/project/%s/service/%s/topic/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(topicName)) _, err := h.doer.Do(ctx, "ServiceKafkaTopicUpdate", "PUT", path, in) return err } diff --git a/handler/mysql/mysql.go b/handler/mysql/mysql.go index 0cc7bca..b35e1ab 100644 --- a/handler/mysql/mysql.go +++ b/handler/mysql/mysql.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -28,7 +29,7 @@ type MySQLHandler struct { } func (h *MySQLHandler) MySQLServiceQueryStatistics(ctx context.Context, project string, serviceName string, in *MySqlserviceQueryStatisticsIn) ([]QueryOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/mysql/query/stats", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/mysql/query/stats", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "MySQLServiceQueryStatistics", "POST", path, in) if err != nil { return nil, err diff --git a/handler/opensearch/opensearch.go b/handler/opensearch/opensearch.go index 157880d..dbf937b 100644 --- a/handler/opensearch/opensearch.go +++ b/handler/opensearch/opensearch.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -64,7 +65,7 @@ type OpenSearchHandler struct { } func (h *OpenSearchHandler) ServiceOpenSearchAclGet(ctx context.Context, project string, serviceName string) (*ServiceOpenSearchAclGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/acl", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/acl", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceOpenSearchAclGet", "GET", path, nil) if err != nil { return nil, err @@ -77,7 +78,7 @@ func (h *OpenSearchHandler) ServiceOpenSearchAclGet(ctx context.Context, project return &out.OpensearchAclConfig, nil } func (h *OpenSearchHandler) ServiceOpenSearchAclSet(ctx context.Context, project string, serviceName string, in *ServiceOpenSearchAclSetIn) (*ServiceOpenSearchAclSetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/acl", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/acl", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceOpenSearchAclSet", "POST", path, in) if err != nil { return nil, err @@ -90,7 +91,7 @@ func (h *OpenSearchHandler) ServiceOpenSearchAclSet(ctx context.Context, project return &out.OpensearchAclConfig, nil } func (h *OpenSearchHandler) ServiceOpenSearchAclUpdate(ctx context.Context, project string, serviceName string, in *ServiceOpenSearchAclUpdateIn) (*ServiceOpenSearchAclUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/acl", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/acl", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceOpenSearchAclUpdate", "PUT", path, in) if err != nil { return nil, err @@ -103,12 +104,12 @@ func (h *OpenSearchHandler) ServiceOpenSearchAclUpdate(ctx context.Context, proj return &out.OpensearchAclConfig, nil } func (h *OpenSearchHandler) ServiceOpenSearchIndexDelete(ctx context.Context, project string, serviceName string, indexName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/index/%s", project, serviceName, indexName) + path := fmt.Sprintf("/v1/project/%s/service/%s/index/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(indexName)) _, err := h.doer.Do(ctx, "ServiceOpenSearchIndexDelete", "DELETE", path, nil) return err } func (h *OpenSearchHandler) ServiceOpenSearchIndexList(ctx context.Context, project string, serviceName string) ([]IndexeOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/index", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/index", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceOpenSearchIndexList", "GET", path, nil) if err != nil { return nil, err @@ -121,7 +122,7 @@ func (h *OpenSearchHandler) ServiceOpenSearchIndexList(ctx context.Context, proj return out.Indexes, nil } func (h *OpenSearchHandler) ServiceOpenSearchSecurityGet(ctx context.Context, project string, serviceName string) (*ServiceOpenSearchSecurityGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/security", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/security", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceOpenSearchSecurityGet", "GET", path, nil) if err != nil { return nil, err @@ -134,7 +135,7 @@ func (h *OpenSearchHandler) ServiceOpenSearchSecurityGet(ctx context.Context, pr return out, nil } func (h *OpenSearchHandler) ServiceOpenSearchSecurityReset(ctx context.Context, project string, serviceName string, in *ServiceOpenSearchSecurityResetIn) (*ServiceOpenSearchSecurityResetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/security/admin", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/security/admin", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceOpenSearchSecurityReset", "PUT", path, in) if err != nil { return nil, err @@ -147,7 +148,7 @@ func (h *OpenSearchHandler) ServiceOpenSearchSecurityReset(ctx context.Context, return out, nil } func (h *OpenSearchHandler) ServiceOpenSearchSecuritySet(ctx context.Context, project string, serviceName string, in *ServiceOpenSearchSecuritySetIn) (*ServiceOpenSearchSecuritySetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/security/admin", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/opensearch/security/admin", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceOpenSearchSecuritySet", "POST", path, in) if err != nil { return nil, err diff --git a/handler/organization/organization.go b/handler/organization/organization.go index 5560122..0836899 100644 --- a/handler/organization/organization.go +++ b/handler/organization/organization.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -69,12 +70,12 @@ type OrganizationHandler struct { } 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) + path := fmt.Sprintf("/v1/organization/%s/authentication-methods/%s/domains", url.PathEscape(organizationId), url.PathEscape(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) + path := fmt.Sprintf("/v1/organization/%s/authentication-methods/%s/domains", url.PathEscape(organizationId), url.PathEscape(authenticationMethodId)) b, err := h.doer.Do(ctx, "OrganizationAuthDomainList", "GET", path, nil) if err != nil { return nil, err @@ -87,12 +88,12 @@ func (h *OrganizationHandler) OrganizationAuthDomainList(ctx context.Context, or 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) + path := fmt.Sprintf("/v1/organization/%s/authentication-methods/%s/domains/%s", url.PathEscape(organizationId), url.PathEscape(authenticationMethodId), url.PathEscape(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) + path := fmt.Sprintf("/v1/organization/%s/config/authentication", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationAuthenticationConfigGet", "GET", path, nil) if err != nil { return nil, err @@ -105,7 +106,7 @@ func (h *OrganizationHandler) OrganizationAuthenticationConfigGet(ctx context.Co return out, nil } func (h *OrganizationHandler) OrganizationAuthenticationConfigUpdate(ctx context.Context, organizationId string, in *OrganizationAuthenticationConfigUpdateIn) (*OrganizationAuthenticationConfigUpdateOut, error) { - path := fmt.Sprintf("/v1/organization/%s/config/authentication", organizationId) + path := fmt.Sprintf("/v1/organization/%s/config/authentication", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationAuthenticationConfigUpdate", "PATCH", path, in) if err != nil { return nil, err @@ -118,7 +119,7 @@ func (h *OrganizationHandler) OrganizationAuthenticationConfigUpdate(ctx context return out, nil } func (h *OrganizationHandler) OrganizationGet(ctx context.Context, organizationId string) (*OrganizationGetOut, error) { - path := fmt.Sprintf("/v1/organization/%s", organizationId) + path := fmt.Sprintf("/v1/organization/%s", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationGet", "GET", path, nil) if err != nil { return nil, err @@ -131,7 +132,7 @@ func (h *OrganizationHandler) OrganizationGet(ctx context.Context, organizationI return out, nil } func (h *OrganizationHandler) OrganizationUpdate(ctx context.Context, organizationId string, in *OrganizationUpdateIn) (*OrganizationUpdateOut, error) { - path := fmt.Sprintf("/v1/organization/%s", organizationId) + path := fmt.Sprintf("/v1/organization/%s", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationUpdate", "PATCH", path, in) if err != nil { return nil, err diff --git a/handler/organizationuser/organizationuser.go b/handler/organizationuser/organizationuser.go index f373372..0098dff 100644 --- a/handler/organizationuser/organizationuser.go +++ b/handler/organizationuser/organizationuser.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -84,7 +85,7 @@ type OrganizationUserHandler struct { } func (h *OrganizationUserHandler) OrganizationUserAuthenticationMethodsList(ctx context.Context, organizationId string, memberUserId string) ([]AuthenticationMethodOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user/%s/authentication_methods", organizationId, memberUserId) + path := fmt.Sprintf("/v1/organization/%s/user/%s/authentication_methods", url.PathEscape(organizationId), url.PathEscape(memberUserId)) b, err := h.doer.Do(ctx, "OrganizationUserAuthenticationMethodsList", "GET", path, nil) if err != nil { return nil, err @@ -97,12 +98,12 @@ func (h *OrganizationUserHandler) OrganizationUserAuthenticationMethodsList(ctx return out.AuthenticationMethods, nil } func (h *OrganizationUserHandler) OrganizationUserDelete(ctx context.Context, organizationId string, memberUserId string) error { - path := fmt.Sprintf("/v1/organization/%s/user/%s", organizationId, memberUserId) + path := fmt.Sprintf("/v1/organization/%s/user/%s", url.PathEscape(organizationId), url.PathEscape(memberUserId)) _, err := h.doer.Do(ctx, "OrganizationUserDelete", "DELETE", path, nil) return err } func (h *OrganizationUserHandler) OrganizationUserGet(ctx context.Context, organizationId string, memberUserId string) (*OrganizationUserGetOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user/%s", organizationId, memberUserId) + path := fmt.Sprintf("/v1/organization/%s/user/%s", url.PathEscape(organizationId), url.PathEscape(memberUserId)) b, err := h.doer.Do(ctx, "OrganizationUserGet", "GET", path, nil) if err != nil { return nil, err @@ -115,17 +116,17 @@ func (h *OrganizationUserHandler) OrganizationUserGet(ctx context.Context, organ return out, nil } func (h *OrganizationUserHandler) OrganizationUserInvitationAccept(ctx context.Context, organizationId string, userEmail string, in *OrganizationUserInvitationAcceptIn) error { - path := fmt.Sprintf("/v1/organization/%s/invitation/%s", organizationId, userEmail) + path := fmt.Sprintf("/v1/organization/%s/invitation/%s", url.PathEscape(organizationId), url.PathEscape(userEmail)) _, err := h.doer.Do(ctx, "OrganizationUserInvitationAccept", "POST", path, in) return err } func (h *OrganizationUserHandler) OrganizationUserInvitationDelete(ctx context.Context, organizationId string, userEmail string) error { - path := fmt.Sprintf("/v1/organization/%s/invitation/%s", organizationId, userEmail) + path := fmt.Sprintf("/v1/organization/%s/invitation/%s", url.PathEscape(organizationId), url.PathEscape(userEmail)) _, err := h.doer.Do(ctx, "OrganizationUserInvitationDelete", "DELETE", path, nil) return err } func (h *OrganizationUserHandler) OrganizationUserInvitationsList(ctx context.Context, organizationId string) ([]InvitationOut, error) { - path := fmt.Sprintf("/v1/organization/%s/invitation", organizationId) + path := fmt.Sprintf("/v1/organization/%s/invitation", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationUserInvitationsList", "GET", path, nil) if err != nil { return nil, err @@ -138,12 +139,12 @@ func (h *OrganizationUserHandler) OrganizationUserInvitationsList(ctx context.Co return out.Invitations, nil } func (h *OrganizationUserHandler) OrganizationUserInvite(ctx context.Context, organizationId string, in *OrganizationUserInviteIn) error { - path := fmt.Sprintf("/v1/organization/%s/invitation", organizationId) + path := fmt.Sprintf("/v1/organization/%s/invitation", url.PathEscape(organizationId)) _, err := h.doer.Do(ctx, "OrganizationUserInvite", "POST", path, in) return err } func (h *OrganizationUserHandler) OrganizationUserList(ctx context.Context, organizationId string) ([]UserOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user", organizationId) + path := fmt.Sprintf("/v1/organization/%s/user", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "OrganizationUserList", "GET", path, nil) if err != nil { return nil, err @@ -156,17 +157,17 @@ func (h *OrganizationUserHandler) OrganizationUserList(ctx context.Context, orga return out.Users, nil } func (h *OrganizationUserHandler) OrganizationUserPasswordReset(ctx context.Context, organizationId string, memberUserId string) error { - path := fmt.Sprintf("/v1/organization/%s/user/%s/reset_password", organizationId, memberUserId) + path := fmt.Sprintf("/v1/organization/%s/user/%s/reset_password", url.PathEscape(organizationId), url.PathEscape(memberUserId)) _, err := h.doer.Do(ctx, "OrganizationUserPasswordReset", "POST", path, nil) return err } func (h *OrganizationUserHandler) OrganizationUserRevokeToken(ctx context.Context, organizationId string, memberUserId string, tokenPrefix string) error { - path := fmt.Sprintf("/v1/organization/%s/user/%s/access-token/%s", organizationId, memberUserId, tokenPrefix) + path := fmt.Sprintf("/v1/organization/%s/user/%s/access-token/%s", url.PathEscape(organizationId), url.PathEscape(memberUserId), url.PathEscape(tokenPrefix)) _, err := h.doer.Do(ctx, "OrganizationUserRevokeToken", "DELETE", path, nil) return err } func (h *OrganizationUserHandler) OrganizationUserTokensList(ctx context.Context, organizationId string, memberUserId string) ([]TokenOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user/%s/access-tokens", organizationId, memberUserId) + path := fmt.Sprintf("/v1/organization/%s/user/%s/access-tokens", url.PathEscape(organizationId), url.PathEscape(memberUserId)) b, err := h.doer.Do(ctx, "OrganizationUserTokensList", "GET", path, nil) if err != nil { return nil, err @@ -179,7 +180,7 @@ func (h *OrganizationUserHandler) OrganizationUserTokensList(ctx context.Context return out.Tokens, nil } func (h *OrganizationUserHandler) OrganizationUserUpdate(ctx context.Context, organizationId string, memberUserId string, in *OrganizationUserUpdateIn) (*OrganizationUserUpdateOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user/%s", organizationId, memberUserId) + path := fmt.Sprintf("/v1/organization/%s/user/%s", url.PathEscape(organizationId), url.PathEscape(memberUserId)) b, err := h.doer.Do(ctx, "OrganizationUserUpdate", "PATCH", path, in) if err != nil { return nil, err diff --git a/handler/postgresql/postgresql.go b/handler/postgresql/postgresql.go index 8065ec5..74abebf 100644 --- a/handler/postgresql/postgresql.go +++ b/handler/postgresql/postgresql.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -53,7 +54,7 @@ type PostgreSQLHandler struct { } func (h *PostgreSQLHandler) PGServiceAvailableExtensions(ctx context.Context, project string, serviceName string) ([]ExtensionOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/pg/available-extensions", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/pg/available-extensions", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "PGServiceAvailableExtensions", "GET", path, nil) if err != nil { return nil, err @@ -66,7 +67,7 @@ func (h *PostgreSQLHandler) PGServiceAvailableExtensions(ctx context.Context, pr return out.Extensions, nil } func (h *PostgreSQLHandler) PGServiceQueryStatistics(ctx context.Context, project string, serviceName string, in *PgserviceQueryStatisticsIn) ([]QueryOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/pg/query/stats", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/pg/query/stats", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "PGServiceQueryStatistics", "POST", path, in) if err != nil { return nil, err @@ -79,7 +80,7 @@ func (h *PostgreSQLHandler) PGServiceQueryStatistics(ctx context.Context, projec return out.Queries, nil } func (h *PostgreSQLHandler) PgAvailableExtensions(ctx context.Context, tenant string) ([]PgOut, error) { - path := fmt.Sprintf("/v1/tenants/%s/pg-available-extensions", tenant) + path := fmt.Sprintf("/v1/tenants/%s/pg-available-extensions", url.PathEscape(tenant)) b, err := h.doer.Do(ctx, "PgAvailableExtensions", "GET", path, nil) if err != nil { return nil, err @@ -92,17 +93,17 @@ func (h *PostgreSQLHandler) PgAvailableExtensions(ctx context.Context, tenant st return out.Pg, nil } func (h *PostgreSQLHandler) ServicePGBouncerCreate(ctx context.Context, project string, serviceName string, in *ServicePgbouncerCreateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connection_pool", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connection_pool", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServicePGBouncerCreate", "POST", path, in) return err } func (h *PostgreSQLHandler) ServicePGBouncerDelete(ctx context.Context, project string, serviceName string, poolName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connection_pool/%s", project, serviceName, poolName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connection_pool/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(poolName)) _, err := h.doer.Do(ctx, "ServicePGBouncerDelete", "DELETE", path, nil) return err } func (h *PostgreSQLHandler) ServicePGBouncerUpdate(ctx context.Context, project string, serviceName string, poolName string, in *ServicePgbouncerUpdateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/connection_pool/%s", project, serviceName, poolName) + path := fmt.Sprintf("/v1/project/%s/service/%s/connection_pool/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(poolName)) _, err := h.doer.Do(ctx, "ServicePGBouncerUpdate", "PUT", path, in) return err } diff --git a/handler/privatelink/privatelink.go b/handler/privatelink/privatelink.go index 22e3255..916ee87 100644 --- a/handler/privatelink/privatelink.go +++ b/handler/privatelink/privatelink.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -88,7 +89,7 @@ type PrivatelinkHandler struct { } func (h *PrivatelinkHandler) PublicPrivatelinkAvailabilityList(ctx context.Context, tenant string) ([]PrivatelinkAvailabilityOut, error) { - path := fmt.Sprintf("/v1/tenants/%s/privatelink-availability", tenant) + path := fmt.Sprintf("/v1/tenants/%s/privatelink-availability", url.PathEscape(tenant)) b, err := h.doer.Do(ctx, "PublicPrivatelinkAvailabilityList", "GET", path, nil) if err != nil { return nil, err @@ -101,7 +102,7 @@ func (h *PrivatelinkHandler) PublicPrivatelinkAvailabilityList(ctx context.Conte return out.PrivatelinkAvailability, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAWSConnectionList(ctx context.Context, project string, serviceName string) ([]ConnectionOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws/connections", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws/connections", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAWSConnectionList", "GET", path, nil) if err != nil { return nil, err @@ -114,7 +115,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAWSConnectionList(ctx context.Con return out.Connections, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAWSCreate(ctx context.Context, project string, serviceName string, in *ServicePrivatelinkAwscreateIn) (*ServicePrivatelinkAwscreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAWSCreate", "POST", path, in) if err != nil { return nil, err @@ -127,7 +128,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAWSCreate(ctx context.Context, pr return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAWSDelete(ctx context.Context, project string, serviceName string) (*ServicePrivatelinkAwsdeleteOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAWSDelete", "DELETE", path, nil) if err != nil { return nil, err @@ -140,7 +141,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAWSDelete(ctx context.Context, pr return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAWSGet(ctx context.Context, project string, serviceName string) (*ServicePrivatelinkAwsgetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAWSGet", "GET", path, nil) if err != nil { return nil, err @@ -153,7 +154,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAWSGet(ctx context.Context, proje return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAWSUpdate(ctx context.Context, project string, serviceName string, in *ServicePrivatelinkAwsupdateIn) (*ServicePrivatelinkAwsupdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/aws", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAWSUpdate", "PUT", path, in) if err != nil { return nil, err @@ -166,7 +167,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAWSUpdate(ctx context.Context, pr return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAzureConnectionApproval(ctx context.Context, project string, serviceName string, privatelinkConnectionId string) (*ServicePrivatelinkAzureConnectionApprovalOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure/connections/%s/approve", project, serviceName, privatelinkConnectionId) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure/connections/%s/approve", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(privatelinkConnectionId)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAzureConnectionApproval", "POST", path, nil) if err != nil { return nil, err @@ -179,7 +180,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAzureConnectionApproval(ctx conte return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAzureConnectionList(ctx context.Context, project string, serviceName string) ([]ConnectionOutAlt, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure/connections", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure/connections", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAzureConnectionList", "GET", path, nil) if err != nil { return nil, err @@ -192,7 +193,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAzureConnectionList(ctx context.C return out.Connections, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAzureConnectionUpdate(ctx context.Context, project string, serviceName string, privatelinkConnectionId string, in *ServicePrivatelinkAzureConnectionUpdateIn) (*ServicePrivatelinkAzureConnectionUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure/connections/%s", project, serviceName, privatelinkConnectionId) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure/connections/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(privatelinkConnectionId)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAzureConnectionUpdate", "PUT", path, in) if err != nil { return nil, err @@ -205,7 +206,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAzureConnectionUpdate(ctx context return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAzureCreate(ctx context.Context, project string, serviceName string, in *ServicePrivatelinkAzureCreateIn) (*ServicePrivatelinkAzureCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAzureCreate", "POST", path, in) if err != nil { return nil, err @@ -218,7 +219,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAzureCreate(ctx context.Context, return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAzureDelete(ctx context.Context, project string, serviceName string) (*ServicePrivatelinkAzureDeleteOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAzureDelete", "DELETE", path, nil) if err != nil { return nil, err @@ -231,7 +232,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAzureDelete(ctx context.Context, return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAzureGet(ctx context.Context, project string, serviceName string) (*ServicePrivatelinkAzureGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAzureGet", "GET", path, nil) if err != nil { return nil, err @@ -244,7 +245,7 @@ func (h *PrivatelinkHandler) ServicePrivatelinkAzureGet(ctx context.Context, pro return out, nil } func (h *PrivatelinkHandler) ServicePrivatelinkAzureUpdate(ctx context.Context, project string, serviceName string, in *ServicePrivatelinkAzureUpdateIn) (*ServicePrivatelinkAzureUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/privatelink/azure", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServicePrivatelinkAzureUpdate", "PUT", path, in) if err != nil { return nil, err diff --git a/handler/project/project.go b/handler/project/project.go index c62052d..3227e1c 100644 --- a/handler/project/project.go +++ b/handler/project/project.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -124,7 +125,7 @@ type ProjectHandler struct { } func (h *ProjectHandler) ListProjectVpcPeeringConnectionTypes(ctx context.Context, project string) ([]VpcPeeringConnectionTypeOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpc-peering-connection-types", project) + path := fmt.Sprintf("/v1/project/%s/vpc-peering-connection-types", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ListProjectVpcPeeringConnectionTypes", "GET", path, nil) if err != nil { return nil, err @@ -137,7 +138,7 @@ func (h *ProjectHandler) ListProjectVpcPeeringConnectionTypes(ctx context.Contex return out.VpcPeeringConnectionTypes, nil } func (h *ProjectHandler) ProjectAlertsList(ctx context.Context, project string) ([]AlertOut, error) { - path := fmt.Sprintf("/v1/project/%s/alerts", project) + path := fmt.Sprintf("/v1/project/%s/alerts", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectAlertsList", "GET", path, nil) if err != nil { return nil, err @@ -163,12 +164,12 @@ func (h *ProjectHandler) ProjectCreate(ctx context.Context, in *ProjectCreateIn) return &out.Project, nil } func (h *ProjectHandler) ProjectDelete(ctx context.Context, project string) error { - path := fmt.Sprintf("/v1/project/%s", project) + path := fmt.Sprintf("/v1/project/%s", url.PathEscape(project)) _, err := h.doer.Do(ctx, "ProjectDelete", "DELETE", path, nil) return err } func (h *ProjectHandler) ProjectGenerateSbomDownloadUrl(ctx context.Context, project string, fileFormat string) (string, error) { - path := fmt.Sprintf("/v1/project/%s/generate-sbom-download-url/%s", project, fileFormat) + path := fmt.Sprintf("/v1/project/%s/generate-sbom-download-url/%s", url.PathEscape(project), url.PathEscape(fileFormat)) b, err := h.doer.Do(ctx, "ProjectGenerateSbomDownloadUrl", "GET", path, nil) if err != nil { return "", err @@ -181,7 +182,7 @@ func (h *ProjectHandler) ProjectGenerateSbomDownloadUrl(ctx context.Context, pro return out.DownloadUrl, nil } func (h *ProjectHandler) ProjectGet(ctx context.Context, project string) (*ProjectGetOut, error) { - path := fmt.Sprintf("/v1/project/%s", project) + path := fmt.Sprintf("/v1/project/%s", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectGet", "GET", path, nil) if err != nil { return nil, err @@ -194,7 +195,7 @@ func (h *ProjectHandler) ProjectGet(ctx context.Context, project string) (*Proje return &out.Project, nil } func (h *ProjectHandler) ProjectGetEventLogs(ctx context.Context, project string) ([]EventOut, error) { - path := fmt.Sprintf("/v1/project/%s/events", project) + path := fmt.Sprintf("/v1/project/%s/events", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectGetEventLogs", "GET", path, nil) if err != nil { return nil, err @@ -207,12 +208,12 @@ func (h *ProjectHandler) ProjectGetEventLogs(ctx context.Context, project string return out.Events, nil } func (h *ProjectHandler) ProjectInvite(ctx context.Context, project string, in *ProjectInviteIn) error { - path := fmt.Sprintf("/v1/project/%s/invite", project) + path := fmt.Sprintf("/v1/project/%s/invite", url.PathEscape(project)) _, err := h.doer.Do(ctx, "ProjectInvite", "POST", path, in) return err } func (h *ProjectHandler) ProjectInviteAccept(ctx context.Context, project string, inviteVerificationCode string) (*ProjectInviteAcceptOut, error) { - path := fmt.Sprintf("/v1/project/%s/invite/%s", project, inviteVerificationCode) + path := fmt.Sprintf("/v1/project/%s/invite/%s", url.PathEscape(project), url.PathEscape(inviteVerificationCode)) b, err := h.doer.Do(ctx, "ProjectInviteAccept", "POST", path, nil) if err != nil { return nil, err @@ -225,12 +226,12 @@ func (h *ProjectHandler) ProjectInviteAccept(ctx context.Context, project string return &out.InviteDetails, nil } func (h *ProjectHandler) ProjectInviteDelete(ctx context.Context, project string, invitedEmail string) error { - path := fmt.Sprintf("/v1/project/%s/invite/%s", project, invitedEmail) + path := fmt.Sprintf("/v1/project/%s/invite/%s", url.PathEscape(project), url.PathEscape(invitedEmail)) _, err := h.doer.Do(ctx, "ProjectInviteDelete", "DELETE", path, nil) return err } func (h *ProjectHandler) ProjectKmsGetCA(ctx context.Context, project string) (string, error) { - path := fmt.Sprintf("/v1/project/%s/kms/ca", project) + path := fmt.Sprintf("/v1/project/%s/kms/ca", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectKmsGetCA", "GET", path, nil) if err != nil { return "", err @@ -256,7 +257,7 @@ func (h *ProjectHandler) ProjectList(ctx context.Context) (*ProjectListOut, erro return out, nil } func (h *ProjectHandler) ProjectPrivatelinkAvailabilityList(ctx context.Context, project string) ([]PrivatelinkAvailabilityOut, error) { - path := fmt.Sprintf("/v1/project/%s/privatelink-availability", project) + path := fmt.Sprintf("/v1/project/%s/privatelink-availability", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectPrivatelinkAvailabilityList", "GET", path, nil) if err != nil { return nil, err @@ -269,7 +270,7 @@ func (h *ProjectHandler) ProjectPrivatelinkAvailabilityList(ctx context.Context, return out.PrivatelinkAvailability, nil } func (h *ProjectHandler) ProjectTagsList(ctx context.Context, project string) (map[string]string, error) { - path := fmt.Sprintf("/v1/project/%s/tags", project) + path := fmt.Sprintf("/v1/project/%s/tags", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectTagsList", "GET", path, nil) if err != nil { return nil, err @@ -282,17 +283,17 @@ func (h *ProjectHandler) ProjectTagsList(ctx context.Context, project string) (m return out.Tags, nil } func (h *ProjectHandler) ProjectTagsReplace(ctx context.Context, project string, in *ProjectTagsReplaceIn) error { - path := fmt.Sprintf("/v1/project/%s/tags", project) + path := fmt.Sprintf("/v1/project/%s/tags", url.PathEscape(project)) _, err := h.doer.Do(ctx, "ProjectTagsReplace", "PUT", path, in) return err } func (h *ProjectHandler) ProjectTagsUpdate(ctx context.Context, project string, in *ProjectTagsUpdateIn) error { - path := fmt.Sprintf("/v1/project/%s/tags", project) + path := fmt.Sprintf("/v1/project/%s/tags", url.PathEscape(project)) _, err := h.doer.Do(ctx, "ProjectTagsUpdate", "PATCH", path, in) return err } func (h *ProjectHandler) ProjectUpdate(ctx context.Context, project string, in *ProjectUpdateIn) (*ProjectUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s", project) + path := fmt.Sprintf("/v1/project/%s", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectUpdate", "PUT", path, in) if err != nil { return nil, err @@ -305,7 +306,7 @@ func (h *ProjectHandler) ProjectUpdate(ctx context.Context, project string, in * return &out.Project, nil } func (h *ProjectHandler) ProjectUserList(ctx context.Context, project string) (*ProjectUserListOut, error) { - path := fmt.Sprintf("/v1/project/%s/users", project) + path := fmt.Sprintf("/v1/project/%s/users", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectUserList", "GET", path, nil) if err != nil { return nil, err @@ -318,12 +319,12 @@ func (h *ProjectHandler) ProjectUserList(ctx context.Context, project string) (* return out, nil } func (h *ProjectHandler) ProjectUserRemove(ctx context.Context, project string, userEmail string) error { - path := fmt.Sprintf("/v1/project/%s/user/%s", project, userEmail) + path := fmt.Sprintf("/v1/project/%s/user/%s", url.PathEscape(project), url.PathEscape(userEmail)) _, err := h.doer.Do(ctx, "ProjectUserRemove", "DELETE", path, nil) return err } func (h *ProjectHandler) ProjectUserUpdate(ctx context.Context, project string, userEmail string, in *ProjectUserUpdateIn) error { - path := fmt.Sprintf("/v1/project/%s/user/%s", project, userEmail) + path := fmt.Sprintf("/v1/project/%s/user/%s", url.PathEscape(project), url.PathEscape(userEmail)) _, err := h.doer.Do(ctx, "ProjectUserUpdate", "PUT", path, in) return err } diff --git a/handler/projectbilling/projectbilling.go b/handler/projectbilling/projectbilling.go index 76f0118..6574765 100644 --- a/handler/projectbilling/projectbilling.go +++ b/handler/projectbilling/projectbilling.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -44,7 +45,7 @@ type ProjectBillingHandler struct { } func (h *ProjectBillingHandler) InvoiceGet(ctx context.Context, invoiceNumber string) (*InvoiceGetOut, error) { - path := fmt.Sprintf("/v1/invoices/%s", invoiceNumber) + path := fmt.Sprintf("/v1/invoices/%s", url.PathEscape(invoiceNumber)) b, err := h.doer.Do(ctx, "InvoiceGet", "GET", path, nil) if err != nil { return nil, err @@ -57,7 +58,7 @@ func (h *ProjectBillingHandler) InvoiceGet(ctx context.Context, invoiceNumber st 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) + path := fmt.Sprintf("/v1/project/%s/credits", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectCreditsClaim", "POST", path, in) if err != nil { return nil, err @@ -70,7 +71,7 @@ func (h *ProjectBillingHandler) ProjectCreditsClaim(ctx context.Context, project return &out.Credit, nil } func (h *ProjectBillingHandler) ProjectCreditsList(ctx context.Context, project string) ([]CreditOut, error) { - path := fmt.Sprintf("/v1/project/%s/credits", project) + path := fmt.Sprintf("/v1/project/%s/credits", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectCreditsList", "GET", path, nil) if err != nil { return nil, err @@ -83,7 +84,7 @@ func (h *ProjectBillingHandler) ProjectCreditsList(ctx context.Context, project return out.Credits, nil } func (h *ProjectBillingHandler) ProjectInvoiceList(ctx context.Context, project string) ([]InvoiceOut, error) { - path := fmt.Sprintf("/v1/project/%s/invoice", project) + path := fmt.Sprintf("/v1/project/%s/invoice", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectInvoiceList", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/service/service.go b/handler/service/service.go index 22eed44..d454c17 100644 --- a/handler/service/service.go +++ b/handler/service/service.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -174,7 +175,7 @@ type ServiceHandler struct { } func (h *ServiceHandler) ListProjectServiceTypes(ctx context.Context, project string) (*ListProjectServiceTypesOut, error) { - path := fmt.Sprintf("/v1/project/%s/service_types", project) + path := fmt.Sprintf("/v1/project/%s/service_types", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ListProjectServiceTypes", "GET", path, nil) if err != nil { return nil, err @@ -213,7 +214,7 @@ func (h *ServiceHandler) ListServiceVersions(ctx context.Context) ([]ServiceVers return out.ServiceVersions, nil } func (h *ServiceHandler) ProjectGetServiceLogs(ctx context.Context, project string, serviceName string, in *ProjectGetServiceLogsIn) (*ProjectGetServiceLogsOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/logs", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/logs", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ProjectGetServiceLogs", "POST", path, in) if err != nil { return nil, err @@ -226,7 +227,7 @@ func (h *ServiceHandler) ProjectGetServiceLogs(ctx context.Context, project stri return out, nil } func (h *ServiceHandler) ProjectServiceTagsList(ctx context.Context, project string, serviceName string) (map[string]string, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/tags", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/tags", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ProjectServiceTagsList", "GET", path, nil) if err != nil { return nil, err @@ -239,17 +240,17 @@ func (h *ServiceHandler) ProjectServiceTagsList(ctx context.Context, project str return out.Tags, nil } func (h *ServiceHandler) ProjectServiceTagsReplace(ctx context.Context, project string, serviceName string, in *ProjectServiceTagsReplaceIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/tags", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/tags", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ProjectServiceTagsReplace", "PUT", path, in) return err } func (h *ServiceHandler) ProjectServiceTagsUpdate(ctx context.Context, project string, serviceName string, in *ProjectServiceTagsUpdateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/tags", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/tags", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ProjectServiceTagsUpdate", "PATCH", path, in) return err } func (h *ServiceHandler) ServiceAlertsList(ctx context.Context, project string, serviceName string) ([]AlertOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/alerts", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/alerts", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceAlertsList", "GET", path, nil) if err != nil { return nil, err @@ -262,7 +263,7 @@ func (h *ServiceHandler) ServiceAlertsList(ctx context.Context, project string, return out.Alerts, nil } func (h *ServiceHandler) ServiceBackupToAnotherRegionReport(ctx context.Context, project string, serviceName string, in *ServiceBackupToAnotherRegionReportIn) (map[string]any, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/backup_to_another_region/report", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/backup_to_another_region/report", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceBackupToAnotherRegionReport", "POST", path, in) if err != nil { return nil, err @@ -275,7 +276,7 @@ func (h *ServiceHandler) ServiceBackupToAnotherRegionReport(ctx context.Context, return out.Metrics, nil } func (h *ServiceHandler) ServiceBackupsGet(ctx context.Context, project string, serviceName string) ([]BackupOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/backups", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/backups", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceBackupsGet", "GET", path, nil) if err != nil { return nil, err @@ -288,7 +289,7 @@ func (h *ServiceHandler) ServiceBackupsGet(ctx context.Context, project string, return out.Backups, nil } func (h *ServiceHandler) ServiceCancelQuery(ctx context.Context, project string, serviceName string, in *ServiceCancelQueryIn) (bool, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/query/cancel", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/query/cancel", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceCancelQuery", "POST", path, in) if err != nil { return false, err @@ -301,7 +302,7 @@ func (h *ServiceHandler) ServiceCancelQuery(ctx context.Context, project string, return out.Success, nil } func (h *ServiceHandler) ServiceCreate(ctx context.Context, project string, in *ServiceCreateIn) (*ServiceCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service", project) + path := fmt.Sprintf("/v1/project/%s/service", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ServiceCreate", "POST", path, in) if err != nil { return nil, err @@ -314,17 +315,17 @@ func (h *ServiceHandler) ServiceCreate(ctx context.Context, project string, in * return &out.Service, nil } func (h *ServiceHandler) ServiceDatabaseCreate(ctx context.Context, project string, serviceName string, in *ServiceDatabaseCreateIn) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/db", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/db", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceDatabaseCreate", "POST", path, in) return err } func (h *ServiceHandler) ServiceDatabaseDelete(ctx context.Context, project string, serviceName string, dbname string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/db/%s", project, serviceName, dbname) + path := fmt.Sprintf("/v1/project/%s/service/%s/db/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(dbname)) _, err := h.doer.Do(ctx, "ServiceDatabaseDelete", "DELETE", path, nil) return err } func (h *ServiceHandler) ServiceDatabaseList(ctx context.Context, project string, serviceName string) ([]DatabaseOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/db", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/db", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceDatabaseList", "GET", path, nil) if err != nil { return nil, err @@ -337,12 +338,12 @@ func (h *ServiceHandler) ServiceDatabaseList(ctx context.Context, project string return out.Databases, nil } func (h *ServiceHandler) ServiceDelete(ctx context.Context, project string, serviceName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceDelete", "DELETE", path, nil) return err } func (h *ServiceHandler) ServiceEnableWrites(ctx context.Context, project string, serviceName string) (string, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/enable-writes", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/enable-writes", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceEnableWrites", "POST", path, nil) if err != nil { return "", err @@ -355,7 +356,7 @@ func (h *ServiceHandler) ServiceEnableWrites(ctx context.Context, project string return out.Until, nil } func (h *ServiceHandler) ServiceGet(ctx context.Context, project string, serviceName string) (*ServiceGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceGet", "GET", path, nil) if err != nil { return nil, err @@ -368,7 +369,7 @@ func (h *ServiceHandler) ServiceGet(ctx context.Context, project string, service return &out.Service, nil } func (h *ServiceHandler) ServiceGetMigrationStatus(ctx context.Context, project string, serviceName string) (*ServiceGetMigrationStatusOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/migration", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/migration", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceGetMigrationStatus", "GET", path, nil) if err != nil { return nil, err @@ -381,7 +382,7 @@ func (h *ServiceHandler) ServiceGetMigrationStatus(ctx context.Context, project return out, nil } func (h *ServiceHandler) ServiceInfluxDBStats(ctx context.Context, project string, serviceName string) (map[string]any, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/influxdb/stats", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/influxdb/stats", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceInfluxDBStats", "GET", path, nil) if err != nil { return nil, err @@ -394,7 +395,7 @@ func (h *ServiceHandler) ServiceInfluxDBStats(ctx context.Context, project strin return out.DbStats, nil } func (h *ServiceHandler) ServiceKmsGetCA(ctx context.Context, project string, serviceName string, caName string) (string, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kms/ca/%s", project, serviceName, caName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kms/ca/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(caName)) b, err := h.doer.Do(ctx, "ServiceKmsGetCA", "GET", path, nil) if err != nil { return "", err @@ -407,7 +408,7 @@ func (h *ServiceHandler) ServiceKmsGetCA(ctx context.Context, project string, se return out.Certificate, nil } func (h *ServiceHandler) ServiceKmsGetKeypair(ctx context.Context, project string, serviceName string, keypairName string) (*ServiceKmsGetKeypairOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/kms/keypairs/%s", project, serviceName, keypairName) + path := fmt.Sprintf("/v1/project/%s/service/%s/kms/keypairs/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(keypairName)) b, err := h.doer.Do(ctx, "ServiceKmsGetKeypair", "GET", path, nil) if err != nil { return nil, err @@ -420,7 +421,7 @@ func (h *ServiceHandler) ServiceKmsGetKeypair(ctx context.Context, project strin return out, nil } func (h *ServiceHandler) ServiceList(ctx context.Context, project string) ([]ServiceOut, error) { - path := fmt.Sprintf("/v1/project/%s/service", project) + path := fmt.Sprintf("/v1/project/%s/service", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ServiceList", "GET", path, nil) if err != nil { return nil, err @@ -433,12 +434,12 @@ func (h *ServiceHandler) ServiceList(ctx context.Context, project string) ([]Ser return out.Services, nil } func (h *ServiceHandler) ServiceMaintenanceStart(ctx context.Context, project string, serviceName string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/maintenance/start", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/maintenance/start", url.PathEscape(project), url.PathEscape(serviceName)) _, err := h.doer.Do(ctx, "ServiceMaintenanceStart", "PUT", path, nil) return err } func (h *ServiceHandler) ServiceMetricsFetch(ctx context.Context, project string, serviceName string, in *ServiceMetricsFetchIn) (map[string]any, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/metrics", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/metrics", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceMetricsFetch", "POST", path, in) if err != nil { return nil, err @@ -451,7 +452,7 @@ func (h *ServiceHandler) ServiceMetricsFetch(ctx context.Context, project string return out.Metrics, nil } func (h *ServiceHandler) ServiceQueryActivity(ctx context.Context, project string, serviceName string, in *ServiceQueryActivityIn) ([]QueryOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/query/activity", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/query/activity", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceQueryActivity", "POST", path, in) if err != nil { return nil, err @@ -464,7 +465,7 @@ func (h *ServiceHandler) ServiceQueryActivity(ctx context.Context, project strin return out.Queries, nil } func (h *ServiceHandler) ServiceQueryStatisticsReset(ctx context.Context, project string, serviceName string) ([]map[string]any, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/query/stats/reset", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/query/stats/reset", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceQueryStatisticsReset", "PUT", path, nil) if err != nil { return nil, err @@ -477,7 +478,7 @@ func (h *ServiceHandler) ServiceQueryStatisticsReset(ctx context.Context, projec return out.Queries, nil } func (h *ServiceHandler) ServiceTaskCreate(ctx context.Context, project string, serviceName string, in *ServiceTaskCreateIn) (*ServiceTaskCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/task", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/task", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceTaskCreate", "POST", path, in) if err != nil { return nil, err @@ -490,7 +491,7 @@ func (h *ServiceHandler) ServiceTaskCreate(ctx context.Context, project string, return &out.Task, nil } func (h *ServiceHandler) ServiceTaskGet(ctx context.Context, project string, serviceName string, taskId string) (*ServiceTaskGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/task/%s", project, serviceName, taskId) + path := fmt.Sprintf("/v1/project/%s/service/%s/task/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(taskId)) b, err := h.doer.Do(ctx, "ServiceTaskGet", "GET", path, nil) if err != nil { return nil, err @@ -503,7 +504,7 @@ func (h *ServiceHandler) ServiceTaskGet(ctx context.Context, project string, ser return &out.Task, nil } func (h *ServiceHandler) ServiceUpdate(ctx context.Context, project string, serviceName string, in *ServiceUpdateIn) (*ServiceUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceUpdate", "PUT", path, in) if err != nil { return nil, err diff --git a/handler/serviceintegration/serviceintegration.go b/handler/serviceintegration/serviceintegration.go index ce78adb..efe8ccb 100644 --- a/handler/serviceintegration/serviceintegration.go +++ b/handler/serviceintegration/serviceintegration.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -83,7 +84,7 @@ type ServiceIntegrationHandler struct { } func (h *ServiceIntegrationHandler) ServiceIntegrationCreate(ctx context.Context, project string, in *ServiceIntegrationCreateIn) (*ServiceIntegrationCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration", project) + path := fmt.Sprintf("/v1/project/%s/integration", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ServiceIntegrationCreate", "POST", path, in) if err != nil { return nil, err @@ -96,12 +97,12 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationCreate(ctx context.Context return &out.ServiceIntegration, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationDelete(ctx context.Context, project string, integrationId string) error { - path := fmt.Sprintf("/v1/project/%s/integration/%s", project, integrationId) + path := fmt.Sprintf("/v1/project/%s/integration/%s", url.PathEscape(project), url.PathEscape(integrationId)) _, err := h.doer.Do(ctx, "ServiceIntegrationDelete", "DELETE", path, nil) return err } func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointCreate(ctx context.Context, project string, in *ServiceIntegrationEndpointCreateIn) (*ServiceIntegrationEndpointCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration_endpoint", project) + path := fmt.Sprintf("/v1/project/%s/integration_endpoint", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ServiceIntegrationEndpointCreate", "POST", path, in) if err != nil { return nil, err @@ -114,12 +115,12 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointCreate(ctx context return &out.ServiceIntegrationEndpoint, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointDelete(ctx context.Context, project string, integrationEndpointId string) error { - path := fmt.Sprintf("/v1/project/%s/integration_endpoint/%s", project, integrationEndpointId) + path := fmt.Sprintf("/v1/project/%s/integration_endpoint/%s", url.PathEscape(project), url.PathEscape(integrationEndpointId)) _, err := h.doer.Do(ctx, "ServiceIntegrationEndpointDelete", "DELETE", path, nil) return err } func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointGet(ctx context.Context, project string, integrationEndpointId string) (*ServiceIntegrationEndpointGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration_endpoint/%s", project, integrationEndpointId) + path := fmt.Sprintf("/v1/project/%s/integration_endpoint/%s", url.PathEscape(project), url.PathEscape(integrationEndpointId)) b, err := h.doer.Do(ctx, "ServiceIntegrationEndpointGet", "GET", path, nil) if err != nil { return nil, err @@ -132,7 +133,7 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointGet(ctx context.Co return &out.ServiceIntegrationEndpoint, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointList(ctx context.Context, project string) ([]ServiceIntegrationEndpointOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration_endpoint", project) + path := fmt.Sprintf("/v1/project/%s/integration_endpoint", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ServiceIntegrationEndpointList", "GET", path, nil) if err != nil { return nil, err @@ -145,7 +146,7 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointList(ctx context.C return out.ServiceIntegrationEndpoints, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointTypes(ctx context.Context, project string) ([]EndpointTypeOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration_endpoint_types", project) + path := fmt.Sprintf("/v1/project/%s/integration_endpoint_types", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ServiceIntegrationEndpointTypes", "GET", path, nil) if err != nil { return nil, err @@ -158,7 +159,7 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointTypes(ctx context. return out.EndpointTypes, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointUpdate(ctx context.Context, project string, integrationEndpointId string, in *ServiceIntegrationEndpointUpdateIn) (*ServiceIntegrationEndpointUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration_endpoint/%s", project, integrationEndpointId) + path := fmt.Sprintf("/v1/project/%s/integration_endpoint/%s", url.PathEscape(project), url.PathEscape(integrationEndpointId)) b, err := h.doer.Do(ctx, "ServiceIntegrationEndpointUpdate", "PUT", path, in) if err != nil { return nil, err @@ -171,7 +172,7 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationEndpointUpdate(ctx context return &out.ServiceIntegrationEndpoint, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationGet(ctx context.Context, project string, integrationId string) (*ServiceIntegrationGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration/%s", project, integrationId) + path := fmt.Sprintf("/v1/project/%s/integration/%s", url.PathEscape(project), url.PathEscape(integrationId)) b, err := h.doer.Do(ctx, "ServiceIntegrationGet", "GET", path, nil) if err != nil { return nil, err @@ -184,7 +185,7 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationGet(ctx context.Context, p return &out.ServiceIntegration, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationList(ctx context.Context, project string, serviceName string) ([]ServiceIntegrationOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/integration", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/integration", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceIntegrationList", "GET", path, nil) if err != nil { return nil, err @@ -197,7 +198,7 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationList(ctx context.Context, return out.ServiceIntegrations, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationTypes(ctx context.Context, project string) ([]IntegrationTypeOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration_types", project) + path := fmt.Sprintf("/v1/project/%s/integration_types", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ServiceIntegrationTypes", "GET", path, nil) if err != nil { return nil, err @@ -210,7 +211,7 @@ func (h *ServiceIntegrationHandler) ServiceIntegrationTypes(ctx context.Context, return out.IntegrationTypes, nil } func (h *ServiceIntegrationHandler) ServiceIntegrationUpdate(ctx context.Context, project string, integrationId string, in *ServiceIntegrationUpdateIn) (*ServiceIntegrationUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/integration/%s", project, integrationId) + path := fmt.Sprintf("/v1/project/%s/integration/%s", url.PathEscape(project), url.PathEscape(integrationId)) b, err := h.doer.Do(ctx, "ServiceIntegrationUpdate", "PUT", path, in) if err != nil { return nil, err diff --git a/handler/serviceuser/serviceuser.go b/handler/serviceuser/serviceuser.go index 5df599a..7c33d63 100644 --- a/handler/serviceuser/serviceuser.go +++ b/handler/serviceuser/serviceuser.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -49,7 +50,7 @@ type ServiceUserHandler struct { } func (h *ServiceUserHandler) ServiceUserCreate(ctx context.Context, project string, serviceName string, in *ServiceUserCreateIn) (*ServiceUserCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/user", project, serviceName) + path := fmt.Sprintf("/v1/project/%s/service/%s/user", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceUserCreate", "POST", path, in) if err != nil { return nil, err @@ -62,7 +63,7 @@ func (h *ServiceUserHandler) ServiceUserCreate(ctx context.Context, project stri return &out.User, nil } func (h *ServiceUserHandler) ServiceUserCredentialsModify(ctx context.Context, project string, serviceName string, serviceUsername string, in *ServiceUserCredentialsModifyIn) (*ServiceUserCredentialsModifyOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s", project, serviceName, serviceUsername) + path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(serviceUsername)) b, err := h.doer.Do(ctx, "ServiceUserCredentialsModify", "PUT", path, in) if err != nil { return nil, err @@ -75,7 +76,7 @@ func (h *ServiceUserHandler) ServiceUserCredentialsModify(ctx context.Context, p return &out.Service, nil } func (h *ServiceUserHandler) ServiceUserCredentialsReset(ctx context.Context, project string, serviceName string, serviceUsername string) (*ServiceUserCredentialsResetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s/credentials/reset", project, serviceName, serviceUsername) + path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s/credentials/reset", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(serviceUsername)) b, err := h.doer.Do(ctx, "ServiceUserCredentialsReset", "PUT", path, nil) if err != nil { return nil, err @@ -88,12 +89,12 @@ func (h *ServiceUserHandler) ServiceUserCredentialsReset(ctx context.Context, pr return &out.Service, nil } func (h *ServiceUserHandler) ServiceUserDelete(ctx context.Context, project string, serviceName string, serviceUsername string) error { - path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s", project, serviceName, serviceUsername) + path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(serviceUsername)) _, err := h.doer.Do(ctx, "ServiceUserDelete", "DELETE", path, nil) return err } func (h *ServiceUserHandler) ServiceUserGet(ctx context.Context, project string, serviceName string, serviceUsername string) (*ServiceUserGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s", project, serviceName, serviceUsername) + path := fmt.Sprintf("/v1/project/%s/service/%s/user/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(serviceUsername)) b, err := h.doer.Do(ctx, "ServiceUserGet", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/staticip/staticip.go b/handler/staticip/staticip.go index 2b195a3..1c7d2fa 100644 --- a/handler/staticip/staticip.go +++ b/handler/staticip/staticip.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -58,7 +59,7 @@ type StaticIPHandler struct { } func (h *StaticIPHandler) ProjectStaticIPAssociate(ctx context.Context, project string, staticIpAddressId string, in *ProjectStaticIpassociateIn) (*ProjectStaticIpassociateOut, error) { - path := fmt.Sprintf("/v1/project/%s/static-ips/%s/association", project, staticIpAddressId) + path := fmt.Sprintf("/v1/project/%s/static-ips/%s/association", url.PathEscape(project), url.PathEscape(staticIpAddressId)) b, err := h.doer.Do(ctx, "ProjectStaticIPAssociate", "POST", path, in) if err != nil { return nil, err @@ -71,7 +72,7 @@ func (h *StaticIPHandler) ProjectStaticIPAssociate(ctx context.Context, project return out, nil } func (h *StaticIPHandler) ProjectStaticIPAvailabilityList(ctx context.Context, project string) ([]StaticIpAddressAvailabilityOut, error) { - path := fmt.Sprintf("/v1/project/%s/static-ip-availability", project) + path := fmt.Sprintf("/v1/project/%s/static-ip-availability", url.PathEscape(project)) b, err := h.doer.Do(ctx, "ProjectStaticIPAvailabilityList", "GET", path, nil) if err != nil { return nil, err @@ -84,7 +85,7 @@ func (h *StaticIPHandler) ProjectStaticIPAvailabilityList(ctx context.Context, p return out.StaticIpAddressAvailability, nil } func (h *StaticIPHandler) ProjectStaticIPDissociate(ctx context.Context, project string, staticIpAddressId string) (*ProjectStaticIpdissociateOut, error) { - path := fmt.Sprintf("/v1/project/%s/static-ips/%s/association", project, staticIpAddressId) + path := fmt.Sprintf("/v1/project/%s/static-ips/%s/association", url.PathEscape(project), url.PathEscape(staticIpAddressId)) b, err := h.doer.Do(ctx, "ProjectStaticIPDissociate", "DELETE", path, nil) if err != nil { return nil, err @@ -97,7 +98,7 @@ func (h *StaticIPHandler) ProjectStaticIPDissociate(ctx context.Context, project return out, nil } func (h *StaticIPHandler) ProjectStaticIPPatch(ctx context.Context, project string, staticIpAddressId string, in *ProjectStaticIppatchIn) (*ProjectStaticIppatchOut, error) { - path := fmt.Sprintf("/v1/project/%s/static-ips/%s", project, staticIpAddressId) + path := fmt.Sprintf("/v1/project/%s/static-ips/%s", url.PathEscape(project), url.PathEscape(staticIpAddressId)) b, err := h.doer.Do(ctx, "ProjectStaticIPPatch", "PATCH", path, in) if err != nil { return nil, err @@ -110,7 +111,7 @@ func (h *StaticIPHandler) ProjectStaticIPPatch(ctx context.Context, project stri return out, nil } func (h *StaticIPHandler) PublicStaticIPAvailabilityList(ctx context.Context, tenant string) ([]StaticIpAddressAvailabilityOut, error) { - path := fmt.Sprintf("/v1/tenants/%s/static-ip-availability", tenant) + path := fmt.Sprintf("/v1/tenants/%s/static-ip-availability", url.PathEscape(tenant)) b, err := h.doer.Do(ctx, "PublicStaticIPAvailabilityList", "GET", path, nil) if err != nil { return nil, err @@ -123,7 +124,7 @@ func (h *StaticIPHandler) PublicStaticIPAvailabilityList(ctx context.Context, te return out.StaticIpAddressAvailability, nil } func (h *StaticIPHandler) StaticIPCreate(ctx context.Context, project string, in *StaticIpcreateIn) (*StaticIpcreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/static-ips", project) + path := fmt.Sprintf("/v1/project/%s/static-ips", url.PathEscape(project)) b, err := h.doer.Do(ctx, "StaticIPCreate", "POST", path, in) if err != nil { return nil, err @@ -136,7 +137,7 @@ func (h *StaticIPHandler) StaticIPCreate(ctx context.Context, project string, in return out, nil } func (h *StaticIPHandler) StaticIPList(ctx context.Context, project string) ([]StaticIpOut, error) { - path := fmt.Sprintf("/v1/project/%s/static-ips", project) + path := fmt.Sprintf("/v1/project/%s/static-ips", url.PathEscape(project)) b, err := h.doer.Do(ctx, "StaticIPList", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/thanos/thanos.go b/handler/thanos/thanos.go index 85220b9..49c20ae 100644 --- a/handler/thanos/thanos.go +++ b/handler/thanos/thanos.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" ) type Handler interface { @@ -28,7 +29,7 @@ type ThanosHandler struct { } 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) + path := fmt.Sprintf("/v1/project/%s/service/%s/thanos/storage/summary", url.PathEscape(project), url.PathEscape(serviceName)) b, err := h.doer.Do(ctx, "ServiceThanosStorageSummary", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/user/user.go b/handler/user/user.go index 8144310..282f426 100644 --- a/handler/user/user.go +++ b/handler/user/user.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -180,12 +181,12 @@ func (h *UserHandler) AccessTokenList(ctx context.Context) ([]TokenOut, error) { return out.Tokens, nil } func (h *UserHandler) AccessTokenRevoke(ctx context.Context, tokenPrefix string) error { - path := fmt.Sprintf("/v1/access_token/%s", tokenPrefix) + path := fmt.Sprintf("/v1/access_token/%s", url.PathEscape(tokenPrefix)) _, err := h.doer.Do(ctx, "AccessTokenRevoke", "DELETE", path, nil) return err } func (h *UserHandler) AccessTokenUpdate(ctx context.Context, tokenPrefix string, in *AccessTokenUpdateIn) (*AccessTokenUpdateOut, error) { - path := fmt.Sprintf("/v1/access_token/%s", tokenPrefix) + path := fmt.Sprintf("/v1/access_token/%s", url.PathEscape(tokenPrefix)) b, err := h.doer.Do(ctx, "AccessTokenUpdate", "PUT", path, in) if err != nil { return nil, err @@ -224,7 +225,7 @@ func (h *UserHandler) CheckPasswordStrengthNewUser(ctx context.Context, in *Chec return &out.PasswordStrength, nil } func (h *UserHandler) OrganizationMemberGroupsList(ctx context.Context, organizationId string, memberUserId string) ([]UserGroupOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user/%s/user-groups", organizationId, memberUserId) + path := fmt.Sprintf("/v1/organization/%s/user/%s/user-groups", url.PathEscape(organizationId), url.PathEscape(memberUserId)) b, err := h.doer.Do(ctx, "OrganizationMemberGroupsList", "GET", path, nil) if err != nil { return nil, err @@ -263,7 +264,7 @@ 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) + path := fmt.Sprintf("/v1/user/%s", url.PathEscape(userId)) _, err := h.doer.Do(ctx, "UserAccountDelete", "DELETE", path, nil) return err } @@ -320,7 +321,7 @@ func (h *UserHandler) UserAuthLoginOptions(ctx context.Context, in *UserAuthLogi return out, nil } func (h *UserHandler) UserAuthenticationMethodDelete(ctx context.Context, userAuthenticationMethodId string) error { - path := fmt.Sprintf("/v1/me/authentication_methods/%s", userAuthenticationMethodId) + path := fmt.Sprintf("/v1/me/authentication_methods/%s", url.PathEscape(userAuthenticationMethodId)) _, err := h.doer.Do(ctx, "UserAuthenticationMethodDelete", "DELETE", path, nil) return err } @@ -374,7 +375,7 @@ func (h *UserHandler) UserPasswordChange(ctx context.Context, in *UserPasswordCh return out.Token, nil } func (h *UserHandler) UserPasswordReset(ctx context.Context, verificationCode string, in *UserPasswordResetIn) error { - path := fmt.Sprintf("/v1/user/password_reset/%s", verificationCode) + path := fmt.Sprintf("/v1/user/password_reset/%s", url.PathEscape(verificationCode)) _, err := h.doer.Do(ctx, "UserPasswordReset", "POST", path, in) return err } @@ -397,7 +398,7 @@ func (h *UserHandler) UserUpdate(ctx context.Context, in *UserUpdateIn) (*UserUp return &out.User, nil } func (h *UserHandler) UserVerifyEmail(ctx context.Context, verificationCode string) (*UserVerifyEmailOut, error) { - path := fmt.Sprintf("/v1/user/verify_email/%s", verificationCode) + path := fmt.Sprintf("/v1/user/verify_email/%s", url.PathEscape(verificationCode)) b, err := h.doer.Do(ctx, "UserVerifyEmail", "POST", path, nil) if err != nil { return nil, err @@ -410,12 +411,12 @@ func (h *UserHandler) UserVerifyEmail(ctx context.Context, verificationCode stri return &out.InviteDetails, nil } func (h *UserHandler) ValidateCreditCode(ctx context.Context, creditCode string) error { - path := fmt.Sprintf("/v1/user/credit_code/%s", creditCode) + path := fmt.Sprintf("/v1/user/credit_code/%s", url.PathEscape(creditCode)) _, err := h.doer.Do(ctx, "ValidateCreditCode", "GET", path, nil) return err } func (h *UserHandler) ValidateReferralCode(ctx context.Context, referralCode string) error { - path := fmt.Sprintf("/v1/me/referral/validation/%s", referralCode) + path := fmt.Sprintf("/v1/me/referral/validation/%s", url.PathEscape(referralCode)) _, err := h.doer.Do(ctx, "ValidateReferralCode", "GET", path, nil) return err } diff --git a/handler/usergroup/usergroup.go b/handler/usergroup/usergroup.go index 7e3c89c..f5a91cd 100644 --- a/handler/usergroup/usergroup.go +++ b/handler/usergroup/usergroup.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -59,7 +60,7 @@ type UserGroupHandler struct { } func (h *UserGroupHandler) UserGroupCreate(ctx context.Context, organizationId string, in *UserGroupCreateIn) (*UserGroupCreateOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user-groups", organizationId) + path := fmt.Sprintf("/v1/organization/%s/user-groups", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "UserGroupCreate", "POST", path, in) if err != nil { return nil, err @@ -72,12 +73,12 @@ func (h *UserGroupHandler) UserGroupCreate(ctx context.Context, organizationId s return out, nil } func (h *UserGroupHandler) UserGroupDelete(ctx context.Context, organizationId string, userGroupId string) error { - path := fmt.Sprintf("/v1/organization/%s/user-groups/%s", organizationId, userGroupId) + path := fmt.Sprintf("/v1/organization/%s/user-groups/%s", url.PathEscape(organizationId), url.PathEscape(userGroupId)) _, err := h.doer.Do(ctx, "UserGroupDelete", "DELETE", path, nil) return err } func (h *UserGroupHandler) UserGroupGet(ctx context.Context, organizationId string, userGroupId string) (*UserGroupGetOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user-groups/%s", organizationId, userGroupId) + path := fmt.Sprintf("/v1/organization/%s/user-groups/%s", url.PathEscape(organizationId), url.PathEscape(userGroupId)) b, err := h.doer.Do(ctx, "UserGroupGet", "GET", path, nil) if err != nil { return nil, err @@ -90,7 +91,7 @@ func (h *UserGroupHandler) UserGroupGet(ctx context.Context, organizationId stri return out, nil } func (h *UserGroupHandler) UserGroupMemberList(ctx context.Context, organizationId string, userGroupId string) ([]MemberOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user-groups/%s/members", organizationId, userGroupId) + path := fmt.Sprintf("/v1/organization/%s/user-groups/%s/members", url.PathEscape(organizationId), url.PathEscape(userGroupId)) b, err := h.doer.Do(ctx, "UserGroupMemberList", "GET", path, nil) if err != nil { return nil, err @@ -103,12 +104,12 @@ func (h *UserGroupHandler) UserGroupMemberList(ctx context.Context, organization return out.Members, nil } func (h *UserGroupHandler) UserGroupMembersUpdate(ctx context.Context, organizationId string, userGroupId string, in *UserGroupMembersUpdateIn) error { - path := fmt.Sprintf("/v1/organization/%s/user-groups/%s/members", organizationId, userGroupId) + path := fmt.Sprintf("/v1/organization/%s/user-groups/%s/members", url.PathEscape(organizationId), url.PathEscape(userGroupId)) _, err := h.doer.Do(ctx, "UserGroupMembersUpdate", "PATCH", path, in) return err } func (h *UserGroupHandler) UserGroupUpdate(ctx context.Context, organizationId string, userGroupId string, in *UserGroupUpdateIn) (*UserGroupUpdateOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user-groups/%s", organizationId, userGroupId) + path := fmt.Sprintf("/v1/organization/%s/user-groups/%s", url.PathEscape(organizationId), url.PathEscape(userGroupId)) b, err := h.doer.Do(ctx, "UserGroupUpdate", "PATCH", path, in) if err != nil { return nil, err @@ -121,7 +122,7 @@ func (h *UserGroupHandler) UserGroupUpdate(ctx context.Context, organizationId s return out, nil } func (h *UserGroupHandler) UserGroupsList(ctx context.Context, organizationId string) ([]UserGroupOut, error) { - path := fmt.Sprintf("/v1/organization/%s/user-groups", organizationId) + path := fmt.Sprintf("/v1/organization/%s/user-groups", url.PathEscape(organizationId)) b, err := h.doer.Do(ctx, "UserGroupsList", "GET", path, nil) if err != nil { return nil, err diff --git a/handler/vpc/vpc.go b/handler/vpc/vpc.go index 2c5f9e0..9b0a154 100644 --- a/handler/vpc/vpc.go +++ b/handler/vpc/vpc.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "time" ) @@ -69,7 +70,7 @@ type VpcHandler struct { } func (h *VpcHandler) VpcCreate(ctx context.Context, project string, in *VpcCreateIn) (*VpcCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs", project) + path := fmt.Sprintf("/v1/project/%s/vpcs", url.PathEscape(project)) b, err := h.doer.Do(ctx, "VpcCreate", "POST", path, in) if err != nil { return nil, err @@ -82,7 +83,7 @@ func (h *VpcHandler) VpcCreate(ctx context.Context, project string, in *VpcCreat return out, nil } func (h *VpcHandler) VpcDelete(ctx context.Context, project string, projectVpcId string) (*VpcDeleteOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs/%s", project, projectVpcId) + path := fmt.Sprintf("/v1/project/%s/vpcs/%s", url.PathEscape(project), url.PathEscape(projectVpcId)) b, err := h.doer.Do(ctx, "VpcDelete", "DELETE", path, nil) if err != nil { return nil, err @@ -95,7 +96,7 @@ func (h *VpcHandler) VpcDelete(ctx context.Context, project string, projectVpcId return out, nil } func (h *VpcHandler) VpcGet(ctx context.Context, project string, projectVpcId string) (*VpcGetOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs/%s", project, projectVpcId) + path := fmt.Sprintf("/v1/project/%s/vpcs/%s", url.PathEscape(project), url.PathEscape(projectVpcId)) b, err := h.doer.Do(ctx, "VpcGet", "GET", path, nil) if err != nil { return nil, err @@ -108,7 +109,7 @@ func (h *VpcHandler) VpcGet(ctx context.Context, project string, projectVpcId st return out, nil } func (h *VpcHandler) VpcList(ctx context.Context, project string) ([]VpcOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs", project) + path := fmt.Sprintf("/v1/project/%s/vpcs", url.PathEscape(project)) b, err := h.doer.Do(ctx, "VpcList", "GET", path, nil) if err != nil { return nil, err @@ -121,7 +122,7 @@ func (h *VpcHandler) VpcList(ctx context.Context, project string) ([]VpcOut, err return out.Vpcs, nil } func (h *VpcHandler) VpcPeeringConnectionCreate(ctx context.Context, project string, projectVpcId string, in *VpcPeeringConnectionCreateIn) (*VpcPeeringConnectionCreateOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections", project, projectVpcId) + path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections", url.PathEscape(project), url.PathEscape(projectVpcId)) b, err := h.doer.Do(ctx, "VpcPeeringConnectionCreate", "POST", path, in) if err != nil { return nil, err @@ -134,7 +135,7 @@ func (h *VpcHandler) VpcPeeringConnectionCreate(ctx context.Context, project str return out, nil } func (h *VpcHandler) VpcPeeringConnectionDelete(ctx context.Context, project string, projectVpcId string, peerCloudAccount string, peerVpc string) (*VpcPeeringConnectionDeleteOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections/peer-accounts/%s/peer-vpcs/%s", project, projectVpcId, peerCloudAccount, peerVpc) + path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections/peer-accounts/%s/peer-vpcs/%s", url.PathEscape(project), url.PathEscape(projectVpcId), url.PathEscape(peerCloudAccount), url.PathEscape(peerVpc)) b, err := h.doer.Do(ctx, "VpcPeeringConnectionDelete", "DELETE", path, nil) if err != nil { return nil, err @@ -147,7 +148,7 @@ func (h *VpcHandler) VpcPeeringConnectionDelete(ctx context.Context, project str return out, nil } func (h *VpcHandler) VpcPeeringConnectionUpdate(ctx context.Context, project string, projectVpcId string, in *VpcPeeringConnectionUpdateIn) (*VpcPeeringConnectionUpdateOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs/%s/user-peer-network-cidrs", project, projectVpcId) + path := fmt.Sprintf("/v1/project/%s/vpcs/%s/user-peer-network-cidrs", url.PathEscape(project), url.PathEscape(projectVpcId)) b, err := h.doer.Do(ctx, "VpcPeeringConnectionUpdate", "PUT", path, in) if err != nil { return nil, err @@ -160,7 +161,7 @@ func (h *VpcHandler) VpcPeeringConnectionUpdate(ctx context.Context, project str return out, nil } func (h *VpcHandler) VpcPeeringConnectionWithRegionDelete(ctx context.Context, project string, projectVpcId string, peerCloudAccount string, peerVpc string, peerRegion string) (*VpcPeeringConnectionWithRegionDeleteOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections/peer-accounts/%s/peer-vpcs/%s/peer-regions/%s", project, projectVpcId, peerCloudAccount, peerVpc, peerRegion) + path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections/peer-accounts/%s/peer-vpcs/%s/peer-regions/%s", url.PathEscape(project), url.PathEscape(projectVpcId), url.PathEscape(peerCloudAccount), url.PathEscape(peerVpc), url.PathEscape(peerRegion)) b, err := h.doer.Do(ctx, "VpcPeeringConnectionWithRegionDelete", "DELETE", path, nil) if err != nil { return nil, err @@ -173,7 +174,7 @@ func (h *VpcHandler) VpcPeeringConnectionWithRegionDelete(ctx context.Context, p return out, nil } func (h *VpcHandler) VpcPeeringConnectionWithResourceGroupDelete(ctx context.Context, project string, projectVpcId string, peerCloudAccount string, peerResourceGroup string, peerVpc string) (*VpcPeeringConnectionWithResourceGroupDeleteOut, error) { - path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections/peer-accounts/%s/peer-resource-groups/%s/peer-vpcs/%s", project, projectVpcId, peerCloudAccount, peerResourceGroup, peerVpc) + path := fmt.Sprintf("/v1/project/%s/vpcs/%s/peering-connections/peer-accounts/%s/peer-resource-groups/%s/peer-vpcs/%s", url.PathEscape(project), url.PathEscape(projectVpcId), url.PathEscape(peerCloudAccount), url.PathEscape(peerResourceGroup), url.PathEscape(peerVpc)) b, err := h.doer.Do(ctx, "VpcPeeringConnectionWithResourceGroupDelete", "DELETE", path, nil) if err != nil { return nil, err