Skip to content

Commit

Permalink
refactor: add edge APIs; tidy client
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gillson <[email protected]>
  • Loading branch information
TylerGillson committed Feb 7, 2024
1 parent 40aebc9 commit 789b3ea
Show file tree
Hide file tree
Showing 69 changed files with 803 additions and 400 deletions.
2 changes: 1 addition & 1 deletion client/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (h *V1Client) ListCloudAccounts(scope string) ([]*models.V1CloudAccountSumm
}
var limit int64 = 0
params.Limit = &limit
resp, err := h.GetClient().V1CloudAccountsListSummary(params)
resp, err := h.Client.V1CloudAccountsListSummary(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand Down
12 changes: 6 additions & 6 deletions client/account_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (h *V1Client) CreateCloudAccountAws(account *models.V1AwsAccount, AccountCo
params = clientV1.NewV1CloudAccountsAwsCreateParams().WithBody(account)
}

success, err := h.GetClient().V1CloudAccountsAwsCreate(params)
success, err := h.Client.V1CloudAccountsAwsCreate(params)
if err != nil {
return "", err
}
Expand All @@ -50,7 +50,7 @@ func validateCloudAccountAws(account *models.V1AwsAccount, h *V1Client) error {
// validate account
paramsValidate := clientV1.NewV1AwsAccountValidateParams()
paramsValidate = paramsValidate.WithAwsCloudAccount(toV1AwsCloudAccount(account))
_, err := h.GetClient().V1AwsAccountValidate(paramsValidate)
_, err := h.Client.V1AwsAccountValidate(paramsValidate)
if err != nil {
return err
}
Expand All @@ -66,7 +66,7 @@ func (h *V1Client) UpdateCloudAccountAws(account *models.V1AwsAccount) error {

uid := account.Metadata.UID
params := clientV1.NewV1CloudAccountsAwsUpdateParamsWithContext(h.Ctx).WithUID(uid).WithBody(account)
_, err := h.GetClient().V1CloudAccountsAwsUpdate(params)
_, err := h.Client.V1CloudAccountsAwsUpdate(params)
return err
}

Expand All @@ -78,7 +78,7 @@ func (h *V1Client) DeleteCloudAccountAws(uid, AccountContext string) error {
case "tenant":
params = clientV1.NewV1CloudAccountsAwsDeleteParams().WithUID(uid)
}
_, err := h.GetClient().V1CloudAccountsAwsDelete(params)
_, err := h.Client.V1CloudAccountsAwsDelete(params)
return err
}

Expand All @@ -90,7 +90,7 @@ func (h *V1Client) GetCloudAccountAws(uid, AccountContext string) (*models.V1Aws
case "tenant":
params = clientV1.NewV1CloudAccountsAwsGetParams().WithUID(uid)
}
success, err := h.GetClient().V1CloudAccountsAwsGet(params)
success, err := h.Client.V1CloudAccountsAwsGet(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand All @@ -105,7 +105,7 @@ func (h *V1Client) GetCloudAccountAws(uid, AccountContext string) (*models.V1Aws
func (h *V1Client) GetCloudAccountsAws() ([]*models.V1AwsAccount, error) {
limit := int64(0)
params := clientV1.NewV1CloudAccountsAwsListParamsWithContext(h.Ctx).WithLimit(&limit)
response, err := h.GetClient().V1CloudAccountsAwsList(params)
response, err := h.Client.V1CloudAccountsAwsList(params)
if err != nil {
return nil, err
}
Expand Down
12 changes: 6 additions & 6 deletions client/account_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (h *V1Client) CreateCloudAccountAzure(account *models.V1AzureAccount, Accou
case "tenant":
params = clientV1.NewV1CloudAccountsAzureCreateParams().WithBody(account)
}
success, err := h.GetClient().V1CloudAccountsAzureCreate(params)
success, err := h.Client.V1CloudAccountsAzureCreate(params)
if err != nil {
return "", err
}
Expand All @@ -50,7 +50,7 @@ func validateCloudAccountAzure(account *models.V1AzureAccount, h *V1Client) erro
paramsValidate := clientV1.NewV1AzureAccountValidateParams()
paramsValidate = paramsValidate.WithAzureCloudAccount(toV1AzureCloudAccount(account))

_, err := h.GetClient().V1AzureAccountValidate(paramsValidate)
_, err := h.Client.V1AzureAccountValidate(paramsValidate)
if err != nil {
return err
}
Expand All @@ -66,7 +66,7 @@ func (h *V1Client) UpdateCloudAccountAzure(account *models.V1AzureAccount) error

uid := account.Metadata.UID
params := clientV1.NewV1CloudAccountsAzureUpdateParamsWithContext(h.Ctx).WithUID(uid).WithBody(account)
_, err := h.GetClient().V1CloudAccountsAzureUpdate(params)
_, err := h.Client.V1CloudAccountsAzureUpdate(params)
return err
}

Expand All @@ -78,7 +78,7 @@ func (h *V1Client) DeleteCloudAccountAzure(uid, AccountContext string) error {
case "tenant":
params = clientV1.NewV1CloudAccountsAzureDeleteParams().WithUID(uid)
}
_, err := h.GetClient().V1CloudAccountsAzureDelete(params)
_, err := h.Client.V1CloudAccountsAzureDelete(params)
return err
}

Expand All @@ -91,7 +91,7 @@ func (h *V1Client) GetCloudAccountAzure(uid, AccountContext string) (*models.V1A
params = clientV1.NewV1CloudAccountsAzureGetParams().WithUID(uid)
}

success, err := h.GetClient().V1CloudAccountsAzureGet(params)
success, err := h.Client.V1CloudAccountsAzureGet(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand All @@ -106,7 +106,7 @@ func (h *V1Client) GetCloudAccountAzure(uid, AccountContext string) (*models.V1A
func (h *V1Client) GetCloudAccountsAzure() ([]*models.V1AzureAccount, error) {
limit := int64(0)
params := clientV1.NewV1CloudAccountsAzureListParamsWithContext(h.Ctx).WithLimit(&limit)
response, err := h.GetClient().V1CloudAccountsAzureList(params)
response, err := h.Client.V1CloudAccountsAzureList(params)
if err != nil {
return nil, err
}
Expand Down
10 changes: 5 additions & 5 deletions client/account_coxedge.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (h *V1Client) CreateCloudAccountCoxEdge(account *models.V1CoxEdgeAccount, A
case "tenant":
params = clientV1.NewV1CloudAccountsCoxEdgeCreateParams().WithBody(account)
}
success, err := h.GetClient().V1CloudAccountsCoxEdgeCreate(params)
success, err := h.Client.V1CloudAccountsCoxEdgeCreate(params)
if err != nil {
return "", err
}
Expand All @@ -27,7 +27,7 @@ func (h *V1Client) CreateCloudAccountCoxEdge(account *models.V1CoxEdgeAccount, A
func (h *V1Client) UpdateCloudAccountCoxEdge(account *models.V1CoxEdgeAccount) error {
uid := account.Metadata.UID
params := clientV1.NewV1CloudAccountsCoxEdgeUpdateParamsWithContext(h.Ctx).WithUID(uid).WithBody(account)
_, err := h.GetClient().V1CloudAccountsCoxEdgeUpdate(params)
_, err := h.Client.V1CloudAccountsCoxEdgeUpdate(params)
return err
}

Expand All @@ -39,7 +39,7 @@ func (h *V1Client) DeleteCloudAccountCoxEdge(uid, AccountContext string) error {
case "tenant":
params = clientV1.NewV1CloudAccountsCoxEdgeDeleteParams().WithUID(uid)
}
_, err := h.GetClient().V1CloudAccountsCoxEdgeDelete(params)
_, err := h.Client.V1CloudAccountsCoxEdgeDelete(params)
return err
}

Expand All @@ -52,7 +52,7 @@ func (h *V1Client) GetCloudAccountCoxEdge(uid, AccountContext string) (*models.V
params = clientV1.NewV1CloudAccountsCoxEdgeGetParams().WithUID(uid)
}

success, err := h.GetClient().V1CloudAccountsCoxEdgeGet(params)
success, err := h.Client.V1CloudAccountsCoxEdgeGet(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand All @@ -67,7 +67,7 @@ func (h *V1Client) GetCloudAccountCoxEdge(uid, AccountContext string) (*models.V
func (h *V1Client) GetCloudAccountsCoxEdge() ([]*models.V1CoxEdgeAccount, error) {
limit := int64(0)
params := clientV1.NewV1CloudAccountsCoxEdgeListParamsWithContext(h.Ctx).WithLimit(&limit)
response, err := h.GetClient().V1CloudAccountsCoxEdgeList(params)
response, err := h.Client.V1CloudAccountsCoxEdgeList(params)
if err != nil {
return nil, err
}
Expand Down
10 changes: 5 additions & 5 deletions client/account_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (h *V1Client) CreateCloudAccountGcp(account *models.V1GcpAccountEntity, Acc
params = clientV1.NewV1CloudAccountsGcpCreateParams().WithBody(account)
}

success, err := h.GetClient().V1CloudAccountsGcpCreate(params)
success, err := h.Client.V1CloudAccountsGcpCreate(params)
if err != nil {
return "", err
}
Expand All @@ -28,7 +28,7 @@ func (h *V1Client) CreateCloudAccountGcp(account *models.V1GcpAccountEntity, Acc
func (h *V1Client) UpdateCloudAccountGcp(account *models.V1GcpAccountEntity) error {
uid := account.Metadata.UID
params := clientV1.NewV1CloudAccountsGcpUpdateParamsWithContext(h.Ctx).WithUID(uid).WithBody(account)
_, err := h.GetClient().V1CloudAccountsGcpUpdate(params)
_, err := h.Client.V1CloudAccountsGcpUpdate(params)
return err
}

Expand All @@ -41,7 +41,7 @@ func (h *V1Client) DeleteCloudAccountGcp(uid, AccountContext string) error {
params = clientV1.NewV1CloudAccountsGcpDeleteParams().WithUID(uid)
}

_, err := h.GetClient().V1CloudAccountsGcpDelete(params)
_, err := h.Client.V1CloudAccountsGcpDelete(params)
return err
}

Expand All @@ -54,7 +54,7 @@ func (h *V1Client) GetCloudAccountGcp(uid, AccountContext string) (*models.V1Gcp
params = clientV1.NewV1CloudAccountsGcpGetParams().WithUID(uid)
}

success, err := h.GetClient().V1CloudAccountsGcpGet(params)
success, err := h.Client.V1CloudAccountsGcpGet(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand All @@ -69,7 +69,7 @@ func (h *V1Client) GetCloudAccountGcp(uid, AccountContext string) (*models.V1Gcp
func (h *V1Client) GetCloudAccountsGcp() ([]*models.V1GcpAccount, error) {
limit := int64(0)
params := clientV1.NewV1CloudAccountsGcpListParamsWithContext(h.Ctx).WithLimit(&limit)
response, err := h.GetClient().V1CloudAccountsGcpList(params)
response, err := h.Client.V1CloudAccountsGcpList(params)
if err != nil {
return nil, err
}
Expand Down
12 changes: 6 additions & 6 deletions client/account_maas.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (h *V1Client) CreateCloudAccountMaas(account *models.V1MaasAccount, Account
params = clientV1.NewV1CloudAccountsMaasCreateParams().WithBody(account)
}

success, err := h.GetClient().V1CloudAccountsMaasCreate(params)
success, err := h.Client.V1CloudAccountsMaasCreate(params)
if err != nil {
return "", err
}
Expand All @@ -46,7 +46,7 @@ func validateCloudAccountMaas(account *models.V1MaasAccount, h *V1Client) error
// validate account
paramsValidate := clientV1.NewV1OverlordsUIDMaasAccountValidateParams().WithUID(PcgId)
paramsValidate = paramsValidate.WithBody(toV1OverlordsUIDMaasAccountValidateBody(account))
_, err := h.GetClient().V1OverlordsUIDMaasAccountValidate(paramsValidate)
_, err := h.Client.V1OverlordsUIDMaasAccountValidate(paramsValidate)
if err != nil {
return err
}
Expand All @@ -62,7 +62,7 @@ func (h *V1Client) UpdateCloudAccountMaas(account *models.V1MaasAccount) error {

uid := account.Metadata.UID
params := clientV1.NewV1CloudAccountsMaasUpdateParamsWithContext(h.Ctx).WithUID(uid).WithBody(account)
_, err := h.GetClient().V1CloudAccountsMaasUpdate(params)
_, err := h.Client.V1CloudAccountsMaasUpdate(params)
return err
}

Expand All @@ -75,7 +75,7 @@ func (h *V1Client) DeleteCloudAccountMaas(uid, AccountContext string) error {
params = clientV1.NewV1CloudAccountsMaasDeleteParams().WithUID(uid)
}

_, err := h.GetClient().V1CloudAccountsMaasDelete(params)
_, err := h.Client.V1CloudAccountsMaasDelete(params)
return err
}

Expand All @@ -88,7 +88,7 @@ func (h *V1Client) GetCloudAccountMaas(uid, AccountContext string) (*models.V1Ma
params = clientV1.NewV1CloudAccountsMaasGetParams().WithUID(uid)
}

success, err := h.GetClient().V1CloudAccountsMaasGet(params)
success, err := h.Client.V1CloudAccountsMaasGet(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand All @@ -103,7 +103,7 @@ func (h *V1Client) GetCloudAccountMaas(uid, AccountContext string) (*models.V1Ma
func (h *V1Client) GetCloudAccountsMaas() ([]*models.V1MaasAccount, error) {
limit := int64(0)
params := clientV1.NewV1CloudAccountsMaasListParamsWithContext(h.Ctx).WithLimit(&limit)
response, err := h.GetClient().V1CloudAccountsMaasList(params)
response, err := h.Client.V1CloudAccountsMaasList(params)
if err != nil {
return nil, err
}
Expand Down
12 changes: 6 additions & 6 deletions client/account_openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (h *V1Client) CreateCloudAccountOpenStack(account *models.V1OpenStackAccoun
params = clientV1.NewV1CloudAccountsOpenStackCreateParams().WithBody(account)
}

success, err := h.GetClient().V1CloudAccountsOpenStackCreate(params)
success, err := h.Client.V1CloudAccountsOpenStackCreate(params)
if err != nil {
return "", err
}
Expand All @@ -46,7 +46,7 @@ func validateCloudAccountOpenStack(account *models.V1OpenStackAccount, h *V1Clie
// validate account
paramsValidate := clientV1.NewV1OverlordsUIDOpenStackAccountValidateParams().WithUID(PcgId)
paramsValidate = paramsValidate.WithBody(toV1OverlordsUIDOpenStackAccountValidateBody(account))
_, err := h.GetClient().V1OverlordsUIDOpenStackAccountValidate(paramsValidate)
_, err := h.Client.V1OverlordsUIDOpenStackAccountValidate(paramsValidate)
if err != nil {
return err
}
Expand All @@ -61,7 +61,7 @@ func (h *V1Client) UpdateCloudAccountOpenStack(account *models.V1OpenStackAccoun

uid := account.Metadata.UID
params := clientV1.NewV1CloudAccountsOpenStackUpdateParamsWithContext(h.Ctx).WithUID(uid).WithBody(account)
_, err := h.GetClient().V1CloudAccountsOpenStackUpdate(params)
_, err := h.Client.V1CloudAccountsOpenStackUpdate(params)
return err
}

Expand All @@ -74,7 +74,7 @@ func (h *V1Client) DeleteCloudAccountOpenStack(uid, AccountContext string) error
params = clientV1.NewV1CloudAccountsOpenStackDeleteParams().WithUID(uid)
}

_, err := h.GetClient().V1CloudAccountsOpenStackDelete(params)
_, err := h.Client.V1CloudAccountsOpenStackDelete(params)
return err
}

Expand All @@ -87,7 +87,7 @@ func (h *V1Client) GetCloudAccountOpenStack(uid, AccountContext string) (*models
params = clientV1.NewV1CloudAccountsOpenStackGetParams().WithUID(uid)
}

success, err := h.GetClient().V1CloudAccountsOpenStackGet(params)
success, err := h.Client.V1CloudAccountsOpenStackGet(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand All @@ -102,7 +102,7 @@ func (h *V1Client) GetCloudAccountOpenStack(uid, AccountContext string) (*models
func (h *V1Client) GetCloudAccountsOpenStack() ([]*models.V1OpenStackAccount, error) {
limit := int64(0)
params := clientV1.NewV1CloudAccountsOpenStackListParamsWithContext(h.Ctx).WithLimit(&limit)
response, err := h.GetClient().V1CloudAccountsOpenStackList(params)
response, err := h.Client.V1CloudAccountsOpenStackList(params)
if err != nil {
return nil, err
}
Expand Down
10 changes: 5 additions & 5 deletions client/account_tke.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (h *V1Client) CreateCloudAccountTke(account *models.V1TencentAccount, Accou
params = clientV1.NewV1CloudAccountsTencentCreateParams().WithBody(account)
}

success, err := h.GetClient().V1CloudAccountsTencentCreate(params)
success, err := h.Client.V1CloudAccountsTencentCreate(params)
if err != nil {
return "", err
}
Expand All @@ -28,7 +28,7 @@ func (h *V1Client) CreateCloudAccountTke(account *models.V1TencentAccount, Accou
func (h *V1Client) UpdateCloudAccountTencent(account *models.V1TencentAccount) error {
uid := account.Metadata.UID
params := clientV1.NewV1CloudAccountsTencentUpdateParamsWithContext(h.Ctx).WithUID(uid).WithBody(account)
_, err := h.GetClient().V1CloudAccountsTencentUpdate(params)
_, err := h.Client.V1CloudAccountsTencentUpdate(params)
return err
}

Expand All @@ -41,7 +41,7 @@ func (h *V1Client) DeleteCloudAccountTke(uid, AccountContext string) error {
params = clientV1.NewV1CloudAccountsTencentDeleteParams().WithUID(uid)
}

_, err := h.GetClient().V1CloudAccountsTencentDelete(params)
_, err := h.Client.V1CloudAccountsTencentDelete(params)
return err
}

Expand All @@ -54,7 +54,7 @@ func (h *V1Client) GetCloudAccountTke(uid, AccountContext string) (*models.V1Ten
params = clientV1.NewV1CloudAccountsTencentGetParams().WithUID(uid)
}

success, err := h.GetClient().V1CloudAccountsTencentGet(params)
success, err := h.Client.V1CloudAccountsTencentGet(params)

var e *transport.TransportError
if errors.As(err, &e) && e.HttpCode == 404 {
Expand All @@ -69,7 +69,7 @@ func (h *V1Client) GetCloudAccountTke(uid, AccountContext string) (*models.V1Ten
func (h *V1Client) GetCloudAccountsTke() ([]*models.V1TencentAccount, error) {
limit := int64(0)
params := clientV1.NewV1CloudAccountsTencentListParamsWithContext(h.Ctx).WithLimit(&limit)
response, err := h.GetClient().V1CloudAccountsTencentList(params)
response, err := h.Client.V1CloudAccountsTencentList(params)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit 789b3ea

Please sign in to comment.