diff --git a/commands/container-registry/artifacts/list.go b/commands/container-registry/artifacts/list.go index 0dcb79362..81562fb2d 100644 --- a/commands/container-registry/artifacts/list.go +++ b/commands/container-registry/artifacts/list.go @@ -16,7 +16,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" cloudapiv6 "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6" "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6/resources" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/registry/patch.go b/commands/container-registry/registry/patch.go index a849ba7a2..e36776d70 100644 --- a/commands/container-registry/registry/patch.go +++ b/commands/container-registry/registry/patch.go @@ -9,7 +9,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/registry/post.go b/commands/container-registry/registry/post.go index 5cea95c60..f10599a1c 100644 --- a/commands/container-registry/registry/post.go +++ b/commands/container-registry/registry/post.go @@ -10,7 +10,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/registry/put.go b/commands/container-registry/registry/put.go index 821ab2b1c..2afcfd9ce 100644 --- a/commands/container-registry/registry/put.go +++ b/commands/container-registry/registry/put.go @@ -9,7 +9,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/registry/registries.go b/commands/container-registry/registry/registries.go index fdee15ca8..5d5d4874f 100644 --- a/commands/container-registry/registry/registries.go +++ b/commands/container-registry/registry/registries.go @@ -7,7 +7,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" "github.com/ionos-cloud/ionosctl/v6/services/container-registry/resources" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" ) diff --git a/commands/container-registry/registry/registry_integration_test.go b/commands/container-registry/registry/registry_integration_test.go index 9b97a9b4f..1cb901586 100644 --- a/commands/container-registry/registry/registry_integration_test.go +++ b/commands/container-registry/registry/registry_integration_test.go @@ -14,7 +14,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/client" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) diff --git a/commands/container-registry/repository/list.go b/commands/container-registry/repository/list.go index 1da86f555..cd7b2832d 100644 --- a/commands/container-registry/repository/list.go +++ b/commands/container-registry/repository/list.go @@ -15,7 +15,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" cloudapiv6 "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6" "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6/resources" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/repository/repository.go b/commands/container-registry/repository/repository.go index caad8c2c5..4ed235ca0 100644 --- a/commands/container-registry/repository/repository.go +++ b/commands/container-registry/repository/repository.go @@ -9,7 +9,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/pkg/functional" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" ) diff --git a/commands/container-registry/token/list.go b/commands/container-registry/token/list.go index a625c202b..3acb202fe 100644 --- a/commands/container-registry/token/list.go +++ b/commands/container-registry/token/list.go @@ -10,7 +10,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/token/patch.go b/commands/container-registry/token/patch.go index 6232a9127..8321a24f1 100644 --- a/commands/container-registry/token/patch.go +++ b/commands/container-registry/token/patch.go @@ -11,7 +11,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/token/post.go b/commands/container-registry/token/post.go index caaee2fff..f0ffa0aba 100644 --- a/commands/container-registry/token/post.go +++ b/commands/container-registry/token/post.go @@ -11,7 +11,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/token/put.go b/commands/container-registry/token/put.go index 85d87a602..5466a374d 100644 --- a/commands/container-registry/token/put.go +++ b/commands/container-registry/token/put.go @@ -11,7 +11,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/token/scopes/add.go b/commands/container-registry/token/scopes/add.go index c0d84794f..87056fc33 100644 --- a/commands/container-registry/token/scopes/add.go +++ b/commands/container-registry/token/scopes/add.go @@ -7,7 +7,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/constants" "github.com/ionos-cloud/ionosctl/v6/internal/printer/jsontabwriter" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/ionos-cloud/ionosctl/v6/commands/container-registry/registry" "github.com/ionos-cloud/ionosctl/v6/internal/core" diff --git a/commands/container-registry/token/scopes/delete.go b/commands/container-registry/token/scopes/delete.go index 8e2f04e57..060dae76a 100644 --- a/commands/container-registry/token/scopes/delete.go +++ b/commands/container-registry/token/scopes/delete.go @@ -9,7 +9,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" "github.com/ionos-cloud/ionosctl/v6/pkg/confirm" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/commands/container-registry/token/scopes/scopes.go b/commands/container-registry/token/scopes/scopes.go index 800b1e401..1e956765c 100644 --- a/commands/container-registry/token/scopes/scopes.go +++ b/commands/container-registry/token/scopes/scopes.go @@ -8,7 +8,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/services/container-registry/resources" "github.com/ionos-cloud/ionosctl/v6/internal/core" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" ) diff --git a/commands/container-registry/token/token_integration_test.go b/commands/container-registry/token/token_integration_test.go index daf38e38d..40bedb363 100644 --- a/commands/container-registry/token/token_integration_test.go +++ b/commands/container-registry/token/token_integration_test.go @@ -17,7 +17,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/commands/container-registry/registry" "github.com/ionos-cloud/ionosctl/v6/commands/container-registry/token/scopes" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) diff --git a/commands/container-registry/token/tokens.go b/commands/container-registry/token/tokens.go index 69b11944c..26943ffe1 100644 --- a/commands/container-registry/token/tokens.go +++ b/commands/container-registry/token/tokens.go @@ -13,7 +13,7 @@ import ( scope "github.com/ionos-cloud/ionosctl/v6/commands/container-registry/token/scopes" "github.com/ionos-cloud/ionosctl/v6/internal/core" "github.com/ionos-cloud/ionosctl/v6/services/container-registry/resources" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" ) diff --git a/commands/container-registry/vulnerabilities/list.go b/commands/container-registry/vulnerabilities/list.go index 9d99ae6de..7823dea52 100644 --- a/commands/container-registry/vulnerabilities/list.go +++ b/commands/container-registry/vulnerabilities/list.go @@ -17,7 +17,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/tabheaders" cloudapiv6 "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6" "github.com/ionos-cloud/ionosctl/v6/services/cloudapi-v6/resources" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/internal/client/model.go b/internal/client/model.go index ddb127098..66073f3f0 100644 --- a/internal/client/model.go +++ b/internal/client/model.go @@ -106,9 +106,6 @@ func newClient(name, pwd, token, hostUrl string, usedLayer *Layer) *Client { dpConfig := dataplatform.NewConfiguration(name, pwd, token, hostUrl) dpConfig.UserAgent = appendUserAgent(dpConfig.UserAgent) - registryConfig := containerregistry.NewConfiguration(name, pwd, token, hostUrl) - registryConfig.UserAgent = appendUserAgent(registryConfig.UserAgent) - vmascConfig := vmasc.NewConfiguration(name, pwd, token, hostUrl) vmascConfig.UserAgent = appendUserAgent(vmascConfig.UserAgent) // DBAAS @@ -127,7 +124,7 @@ func newClient(name, pwd, token, hostUrl string, usedLayer *Layer) *Client { CDNClient: cdn.NewAPIClient(sharedConfig), CertManagerClient: certmanager.NewAPIClient(certManagerConfig), DataplatformClient: dataplatform.NewAPIClient(dpConfig), - RegistryClient: containerregistry.NewAPIClient(registryConfig), + RegistryClient: containerregistry.NewAPIClient(sharedConfig), DnsClient: dns.NewAPIClient(sharedConfig), LoggingServiceClient: logging.NewAPIClient(sharedConfig), VMAscClient: vmasc.NewAPIClient(vmascConfig).AutoScalingGroupsApi, diff --git a/internal/printer/json2table/resource2table/container-registry.go b/internal/printer/json2table/resource2table/container-registry.go index ec364f139..4e71fa476 100644 --- a/internal/printer/json2table/resource2table/container-registry.go +++ b/internal/printer/json2table/resource2table/container-registry.go @@ -5,7 +5,7 @@ import ( "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table" "github.com/ionos-cloud/ionosctl/v6/internal/printer/json2table/jsonpaths" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" ) func ConvertContainerRegistryVulnerabilitiesToTable(vulnerabilities containerregistry.ArtifactVulnerabilityReadList) ( diff --git a/services/container-registry/resources/location.go b/services/container-registry/resources/location.go index 5b24a5396..95dc079f3 100644 --- a/services/container-registry/resources/location.go +++ b/services/container-registry/resources/location.go @@ -4,11 +4,12 @@ import ( "context" client2 "github.com/ionos-cloud/ionosctl/v6/internal/client" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" ) type LocationsService interface { - Get() (containerregistry.LocationsResponse, *containerregistry.APIResponse, error) + Get() (containerregistry.LocationsResponse, *shared.APIResponse, error) } type locationsService struct { @@ -25,7 +26,7 @@ func NewLocationsService(client *client2.Client, ctx context.Context) LocationsS } } -func (svc *locationsService) Get() (containerregistry.LocationsResponse, *containerregistry.APIResponse, error) { +func (svc *locationsService) Get() (containerregistry.LocationsResponse, *shared.APIResponse, error) { req := svc.client.LocationsApi.LocationsGet(svc.context) loc, res, err := svc.client.LocationsApi.LocationsGetExecute(req) return loc, res, err diff --git a/services/container-registry/resources/name.go b/services/container-registry/resources/name.go index 769b1b9fa..4bf864be8 100644 --- a/services/container-registry/resources/name.go +++ b/services/container-registry/resources/name.go @@ -4,13 +4,14 @@ import ( "context" client2 "github.com/ionos-cloud/ionosctl/v6/internal/client" + "github.com/ionos-cloud/sdk-go-bundle/shared" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" ) // NameService is a contract for the name service. type NameService interface { - Head(name string) (*containerregistry.APIResponse, error) + Head(name string) (*shared.APIResponse, error) } // NameServiceOp is an implementation of the NameService interface. @@ -29,8 +30,8 @@ func NewNameService(client *client2.Client, ctx context.Context) NameService { } } -// Get returns a containerregistry.APIResponse. -func (svc *nameService) Head(name string) (*containerregistry.APIResponse, error) { +// Get returns a *shared.APIResponse. +func (svc *nameService) Head(name string) (*shared.APIResponse, error) { req := svc.client.NamesApi.NamesCheckUsage(svc.context, name) res, err := svc.client.NamesApi.NamesCheckUsageExecute(req) return res, err diff --git a/services/container-registry/resources/registry.go b/services/container-registry/resources/registry.go index 8eec56a64..239679709 100644 --- a/services/container-registry/resources/registry.go +++ b/services/container-registry/resources/registry.go @@ -4,17 +4,18 @@ import ( "context" client2 "github.com/ionos-cloud/ionosctl/v6/internal/client" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" ) // RegistriesService is a wrapper around ionoscloud.Registry type RegistriesService interface { - Get(id string) (containerregistry.RegistryResponse, *containerregistry.APIResponse, error) - List(filterName string) (containerregistry.RegistriesResponse, *containerregistry.APIResponse, error) - Post(input containerregistry.PostRegistryInput) (containerregistry.PostRegistryOutput, *containerregistry.APIResponse, error) - Delete(id string) (*containerregistry.APIResponse, error) - Patch(id string, input containerregistry.PatchRegistryInput) (containerregistry.RegistryResponse, *containerregistry.APIResponse, error) - Put(id string, input containerregistry.PutRegistryInput) (containerregistry.PutRegistryOutput, *containerregistry.APIResponse, error) + Get(id string) (containerregistry.RegistryResponse, *shared.APIResponse, error) + List(filterName string) (containerregistry.RegistriesResponse, *shared.APIResponse, error) + Post(input containerregistry.PostRegistryInput) (containerregistry.PostRegistryOutput, *shared.APIResponse, error) + Delete(id string) (*shared.APIResponse, error) + Patch(id string, input containerregistry.PatchRegistryInput) (containerregistry.RegistryResponse, *shared.APIResponse, error) + Put(id string, input containerregistry.PutRegistryInput) (containerregistry.PutRegistryOutput, *shared.APIResponse, error) } type registriesService struct { @@ -31,7 +32,7 @@ func NewRegistriesService(client *client2.Client, ctx context.Context) Registrie } } -func (svc *registriesService) List(filterName string) (containerregistry.RegistriesResponse, *containerregistry.APIResponse, error) { +func (svc *registriesService) List(filterName string) (containerregistry.RegistriesResponse, *shared.APIResponse, error) { req := svc.client.RegistriesApi.RegistriesGet(svc.context) if filterName != "" { req = req.FilterName(filterName) @@ -40,26 +41,26 @@ func (svc *registriesService) List(filterName string) (containerregistry.Registr return registryList, res, err } -func (svc *registriesService) Post(input containerregistry.PostRegistryInput) (containerregistry.PostRegistryOutput, *containerregistry.APIResponse, error) { +func (svc *registriesService) Post(input containerregistry.PostRegistryInput) (containerregistry.PostRegistryOutput, *shared.APIResponse, error) { req := svc.client.RegistriesApi.RegistriesPost(svc.context).PostRegistryInput(input) registryList, res, err := svc.client.RegistriesApi.RegistriesPostExecute(req) return registryList, res, err } -func (svc *registriesService) Get(id string) (containerregistry.RegistryResponse, *containerregistry.APIResponse, error) { +func (svc *registriesService) Get(id string) (containerregistry.RegistryResponse, *shared.APIResponse, error) { req := svc.client.RegistriesApi.RegistriesFindById(svc.context, id) reg, res, err := svc.client.RegistriesApi.RegistriesFindByIdExecute(req) return reg, res, err } -func (svc *registriesService) Delete(id string) (*containerregistry.APIResponse, error) { +func (svc *registriesService) Delete(id string) (*shared.APIResponse, error) { req := svc.client.RegistriesApi.RegistriesDelete(svc.context, id) res, err := svc.client.RegistriesApi.RegistriesDeleteExecute(req) return res, err } func (svc *registriesService) Patch(id string, input containerregistry.PatchRegistryInput) ( - containerregistry.RegistryResponse, *containerregistry.APIResponse, error, + containerregistry.RegistryResponse, *shared.APIResponse, error, ) { req := svc.client.RegistriesApi.RegistriesPatch(svc.context, id).PatchRegistryInput(input) reg, res, err := svc.client.RegistriesApi.RegistriesPatchExecute(req) @@ -67,7 +68,7 @@ func (svc *registriesService) Patch(id string, input containerregistry.PatchRegi } func (svc *registriesService) Put(id string, input containerregistry.PutRegistryInput) ( - containerregistry.PutRegistryOutput, *containerregistry.APIResponse, error, + containerregistry.PutRegistryOutput, *shared.APIResponse, error, ) { req := svc.client.RegistriesApi.RegistriesPut(svc.context, id).PutRegistryInput(input) reg, res, err := svc.client.RegistriesApi.RegistriesPutExecute(req) diff --git a/services/container-registry/resources/repository.go b/services/container-registry/resources/repository.go index c3e6ef169..b7a8792d7 100644 --- a/services/container-registry/resources/repository.go +++ b/services/container-registry/resources/repository.go @@ -4,11 +4,12 @@ import ( "context" client2 "github.com/ionos-cloud/ionosctl/v6/internal/client" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" ) type RepositoryService interface { - Delete(regId string, name string) (*containerregistry.APIResponse, error) + Delete(regId string, name string) (*shared.APIResponse, error) } type repositoryService struct { @@ -25,7 +26,7 @@ func NewRepositoryService(client *client2.Client, ctx context.Context) Repositor } } -func (svc *repositoryService) Delete(regId string, name string) (*containerregistry.APIResponse, error) { +func (svc *repositoryService) Delete(regId string, name string) (*shared.APIResponse, error) { req := svc.client.RepositoriesApi.RegistriesRepositoriesDelete(svc.context, regId, name) res, err := svc.client.RepositoriesApi.RegistriesRepositoriesDeleteExecute(req) return res, err diff --git a/services/container-registry/resources/token.go b/services/container-registry/resources/token.go index 1c6381fed..d263df1c7 100644 --- a/services/container-registry/resources/token.go +++ b/services/container-registry/resources/token.go @@ -4,17 +4,18 @@ import ( "context" client2 "github.com/ionos-cloud/ionosctl/v6/internal/client" - containerregistry "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/products/containerregistry/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" ) // TokenService is a wrapper around ionoscloud.Registry type TokenService interface { - Get(id string, registryId string) (containerregistry.TokenResponse, *containerregistry.APIResponse, error) - List(registryId string) (containerregistry.TokensResponse, *containerregistry.APIResponse, error) - Post(input containerregistry.PostTokenInput, registryId string) (containerregistry.PostTokenOutput, *containerregistry.APIResponse, error) - Delete(id string, registryId string) (*containerregistry.APIResponse, error) - Patch(id string, input containerregistry.PatchTokenInput, registryId string) (containerregistry.TokenResponse, *containerregistry.APIResponse, error) - Put(id string, input containerregistry.PutTokenInput, registryId string) (containerregistry.PutTokenOutput, *containerregistry.APIResponse, error) + Get(id string, registryId string) (containerregistry.TokenResponse, *shared.APIResponse, error) + List(registryId string) (containerregistry.TokensResponse, *shared.APIResponse, error) + Post(input containerregistry.PostTokenInput, registryId string) (containerregistry.PostTokenOutput, *shared.APIResponse, error) + Delete(id string, registryId string) (*shared.APIResponse, error) + Patch(id string, input containerregistry.PatchTokenInput, registryId string) (containerregistry.TokenResponse, *shared.APIResponse, error) + Put(id string, input containerregistry.PutTokenInput, registryId string) (containerregistry.PutTokenOutput, *shared.APIResponse, error) } type tokenService struct { @@ -31,32 +32,32 @@ func NewTokenService(client *client2.Client, ctx context.Context) TokenService { } } -func (svc *tokenService) List(registryId string) (containerregistry.TokensResponse, *containerregistry.APIResponse, error) { +func (svc *tokenService) List(registryId string) (containerregistry.TokensResponse, *shared.APIResponse, error) { req := svc.client.TokensApi.RegistriesTokensGet(svc.context, registryId) tokenList, res, err := svc.client.TokensApi.RegistriesTokensGetExecute(req) return tokenList, res, err } -func (svc *tokenService) Post(input containerregistry.PostTokenInput, registryId string) (containerregistry.PostTokenOutput, *containerregistry.APIResponse, error) { +func (svc *tokenService) Post(input containerregistry.PostTokenInput, registryId string) (containerregistry.PostTokenOutput, *shared.APIResponse, error) { req := svc.client.TokensApi.RegistriesTokensPost(svc.context, registryId).PostTokenInput(input) tokenPost, res, err := svc.client.TokensApi.RegistriesTokensPostExecute(req) return tokenPost, res, err } -func (svc *tokenService) Get(id string, registryId string) (containerregistry.TokenResponse, *containerregistry.APIResponse, error) { +func (svc *tokenService) Get(id string, registryId string) (containerregistry.TokenResponse, *shared.APIResponse, error) { req := svc.client.TokensApi.RegistriesTokensFindById(svc.context, registryId, id) reg, res, err := svc.client.TokensApi.RegistriesTokensFindByIdExecute(req) return reg, res, err } -func (svc *tokenService) Delete(id string, registryId string) (*containerregistry.APIResponse, error) { +func (svc *tokenService) Delete(id string, registryId string) (*shared.APIResponse, error) { req := svc.client.TokensApi.RegistriesTokensDelete(svc.context, registryId, id) res, err := svc.client.TokensApi.RegistriesTokensDeleteExecute(req) return res, err } func (svc *tokenService) Patch(id string, input containerregistry.PatchTokenInput, registryId string) ( - containerregistry.TokenResponse, *containerregistry.APIResponse, error, + containerregistry.TokenResponse, *shared.APIResponse, error, ) { req := svc.client.TokensApi.RegistriesTokensPatch(svc.context, registryId, id).PatchTokenInput(input) reg, res, err := svc.client.TokensApi.RegistriesTokensPatchExecute(req) @@ -64,7 +65,7 @@ func (svc *tokenService) Patch(id string, input containerregistry.PatchTokenInpu } func (svc *tokenService) Put(id string, input containerregistry.PutTokenInput, registryId string) ( - containerregistry.PutTokenOutput, *containerregistry.APIResponse, error, + containerregistry.PutTokenOutput, *shared.APIResponse, error, ) { req := svc.client.TokensApi.RegistriesTokensPut(svc.context, registryId, id).PutTokenInput(input) reg, res, err := svc.client.TokensApi.RegistriesTokensPutExecute(req)